[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: QImage conversion functions
From: David Johnson <david () usermode ! org>
Date: 2008-08-26 19:55:29
Message-ID: 200808261255.29097.david () usermode ! org
[Download RAW message or body]
On Tuesday 26 August 2008 12:49:44 pm David Johnson wrote:
> QImage likes to keep stuff in its own internal format, so for example when
> you scale the image you lose the mono format. Reordering your operations
> fixed most things. What isn't fixed is the bit depth of the saved image. I
> think this is just how QImage saves TIFF images. When you save as PNG you
> get 1 bit depth.
Here's the code I meant to attach:
#include <QDebug>
#include <QtGui>
int main()
{
QImage img = QImage("image.png");
int newHeight= img.height()*2;
int newWidth= img.width()*2;
img = img.scaled(newWidth, newHeight, Qt::KeepAspectRatio,
Qt::SmoothTransformation);
img = img.convertToFormat(QImage::Format_Mono, Qt::MonoOnly);
img.setDotsPerMeterX(150*39); //150 dpi
img.setDotsPerMeterY(150*39); //150 dpi
qDebug() << img.depth();
img.save("output.tif", "tiff", 100);
img.save("output.png", "png", 100);
}
--
David Johnson
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic