[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: QImage conversion functions
From:       Thomas Gillespie <tomjamesgillespie () googlemail ! com>
Date:       2008-08-26 18:04:11
Message-ID: 200808261904.11770.tomjamesgillespie () googlemail ! com
[Download RAW message or body]

On Tuesday 26 August 2008 17:58:07 David Johnson wrote:
>
> Yes, QImage should be able to do it all. QImage gives you almost full
> control over images. To convert to monochrome, you would use
> convertToFormat(). I think "density" is ImageMagick's name for
> dots-per-inch, and QImage has dotsPerMeterX() and dotsPerMeterY().
> Compression happens when saving the image. A quality setting of 100 should
> do it, but if you need more control over compression you can use
> QImageWriter.

Ok, I've tried this:

Image = QImage(file).convertToFormat(QImage::Format_Indexed8, Qt::MonoOnly);
Image.setDotsPerMeterX(150*39); //150 dpi
Image.setDotsPerMeterY(150*39); //150 dpi
int newHeight= Image.height()*2;
int newWidth= Image.width()*2;
Image = Image.scaled(newWidth, newHeight, Qt::KeepAspectRatio, 
Qt::SmoothTransformation);
kDebug() << Image.depth();
Image.save("output.tif", "tiff", 100);

But it doesnt seem to work... when i open the image in krita it tells me that 
the dpi is 100 and the colour space is rgb 8 bit, and even wierder the kDebug 
call reports the depth as 32. So tesseract doesnt seem to like it. Any ideas 
what im doing wrong?

Thanks

Tom
 
>> 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