[Qt-interest] why no 8-bit gray in QImage::Format?

Mihail Naydenov mlists at ymail.com
Thu Sep 17 10:10:11 CEST 2009


s2 does not have a palette.
>From the docs:
" Note that if you create an 8-bit image manually, you have to set a valid color table on the image as well. "

You can just copy the pal (colorTable) from s1 to s2, or create a new one (filled with 0-255 values)


>
>From: James Yan <jyan972 at gmail.com>
>To: Mihail Naydenov <mlists at ymail.com>
>Sent: Wednesday, September 16, 2009 8:35:27 PM
>Subject: Re: [Qt-interest] why no 8-bit gray in QImage::Format?
>
>>thanks it works, but:
>
>
>QImage qi;
>qi.load(somefile);
>QImage s1 = qi.converFormat(QImage:: Format_Indexed8 );
>QImage s2(qi.width(),qi.height(),QImage:: Format_Indexed8);
>my_some_func(qi.bits(),s1.bits(),...); // take qi.bits() as source my own-made c function change s1.bits() directy.
>my_some_func(qi.bits(),s2.bits(),...);
>s1.save(dst_file_name1);
>s2.save(dst_file_name2);
>then i found, s1 just saved a normal gray file, while, s2 does NOT. i dont know why.
>
>
>On Wed, Sep 16, 2009 at 8:07 PM, Mihail Naydenov <mlists at ymail.com> wrote:
>
>Use QImage::Format_Indexed8 with grayscale palette.
>>
>>
>>>
>>>From: James Yan <jyan972 at gmail.com>
>>>To: qt-interest at trolltech.com
>>>Sent: Wednesday, September 16, 2009 9:52:59 AM
>>>Subject: [Qt-interest] why no 8-bit gray in QImage::Format?
>>>
>>>
>>>>>>i need a picture in 0-255 gray, but it looks no such format in QImage::Format :(
>>>
>>
>


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090917/b968baa9/attachment.html 


More information about the Qt-interest-old mailing list