[Qt-interest] Enhanced monochrome conversion
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Thu Nov 26 12:03:51 CET 2009
Andre Somers wrote on Thursday, November 26, 2009 11:47 AM:
>> It's easy to convert any image to monochrome format by using
>> QImage::convertToFormat like this:
>> ...
> Hi, interesting problem, but I'd say there is a relatively
> straitforward way to get an answer: read the GIMP sourcecode
Or let a dedicated image processing library do the job. ImageMagick (http://www.imagemagick.org) does the trick maybe. It requires some work to convert between QImage and the ImageMagick (I'd recommend the C++ API, http://www.imagemagick.org/Magick++/) http://www.imagemagick.org/Magick++/Image.html, but it is doable (I remember though that I went the "cheap" but reliable way to store the QImage in-memory as PNG, and read it from memory as PNG into the Magick++ Image - but it should be doable by reading the "raw" memory from QImage and put it into the Image, but then you have to take care about memory alignment, colour depth etc.)
Once you have your data into your Magick++ Image object, check out:
http://www.imagemagick.org/Magick++/Image.html#Image%20Manipulation%20Methods
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list