[Qt-interest] Saving monochrome image

Alessandro Portale Alessandro.Portale at trolltech.com
Sun Aug 16 13:15:26 CEST 2009


M. Bashir Al-Noimi schrieb:
> Alessandro Portale wrote:
>> I am afraid that in Qt 4.5, the tiff output will not produce what you 
>> are looking for. It will always write an Rgb image.
>>
>> Qt 4.6 will support monochrome image saving. See the commit:
>> http://qt.gitorious.org/qt/qt/commit/2dc47ad36f235ba053a329179be4ed87d0b4d484 
>>
> Do you think it better to create feature request in Qt issue tracker ?

The feature is in for 4.6. New features in Qt will only go into a new 
minor version (e.g 4.6). All patch versions for minor version 4.5 (e.g. 
4.5.3) will contain only bug fixes.
We are working hard to release Qt 4.6, ASAP.

>> If I read the code correctly, it will use CCITT RLE compression for 
>> monochrome images.
>>
>> If you need monocrome tiff saving before Qt 4.6 comes out, you may 
>> need to use libtiff directly, or easier: Use FreeImage. Since you can 
>> get the image data -see "QImage::bits()"- from your QImage, it is not 
>> so hard to make those extra libs interoperate with your Qt app.
>>   
> After your post, I fixed this issue by using a stupid way -but it works- 
> by passing arguments to gimp for converting the resultant tiffs to 
> uncompressed monochrome.

I can understand that this solution, even if it works does not make you 
happy.

<experimental>
If your timeline permits and if patching and compiling Qt is an option, 
you may try to backport the feature from 4.6 to 4.5 by replacing your 
files in src/plugins/imageformats with those in
http://qt.gitorious.org/qt/qt/trees/HEAD/src/plugins/imageformats/tiff
...I didn't try that and do not guarantee anything, however.
</experimental>

Alessandro



More information about the Qt-interest-old mailing list