Qimage Indexed 8

Posted on by
Qimage Indexed 8 Rating: 6,7/10 1771votes

Until now I had a QImage with QImage::Format_Indexed8. I fill the array with the needed color data[y*width+x] = i and everything works fine.

Qimage Indexed 8Qimage Format Indexed 8

Default Re: QImage-Greyscale-8-bits-pixel. You have converted your image to an indexed format, which means that pixel() doesn't return a color, but an index in the color table (see QImage::color()). If that image is grayscale, you don't have to convert it, just take one of the color components from the pixels. Hello jsulm and j.Hilk I mean like loading the image and finding the closest colors in the current color set, and converting them into a array of 4 bit indexed pixel. Qimage Ultimate photo printing software: print multiple photos, mixed sizes, maximum quality with the most recommended photo printing software on the web for PC/Windows!

But now i need RGB instead of Indexed8 so I use QImage::Format_RGB32. Allocating memory: data = static_cast(malloc(sizeof(unsigned char)*4*HEIGHT*WIDTH)); Filling array for QImage: data[(y*width+x)*4] = QColor(i, 0, 0).value(); Well, the image seems right, but it is dark blue instead of (lighter) red! What is wrong? The calculating of the index or the color?

I am using Qt 4.8.6 Thank you! Update data[(y*width+x)*4] = 0x00; data[(y*width+x)*4+1] = 0x00; data[(y*width+x)*4+2] = i; data[(y*width+x)*4+3] = 0xFF; This would work, so I think the problem of my first try must be, that I only wrote in first char and not all 4, but is there any other way to do that? How To Activate Motorola Start Ac Pictures on this page.

Hey, The documentation lists a constructor for setting the colortable for a indexed QImage but doesn't specify what is supposed to be passed in. De.QtGui.QImage.setColorTable The corresponding Qt function takes a QVector, but there does not appear to be a QVector structure in PySide.

Can somebody tell me what the correct way to create a color table for an indexed QImage using PySide is? Also, somebody should probably update the documentation so that the proper arg types are listed.

- Sam On 7/29/11 4:00 AM, ' wrote: >Send PySide mailing list submissions to >>>To subscribe or unsubscribe via the World Wide Web, visit >>or, via email, send a message with subject or body 'help' to >>>You can reach the person managing the list at >>>When replying, please edit your Subject line so it is more specific >than 'Re: Contents of PySide digest.' >>>Today's Topics: >>1. Re: QImage around existing image data buffer; C++ vs pyside >(Gordon L. Kindlmann) >2.

Re: QImage around existing image data buffer; C++ vs pyside >(Gerald Storer) >>>---------------------------------------------------------------------- >>Message: 1 >Date: Fri, 29 Jul 2011 00:37:17 -0500 >From: 'Gordon L. Kindlmann' >To: >Subject: Re: [PySide] QImage around existing image data buffer; C++ vs >pyside >Message-ID: >Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes >>On Wednesday 27 Jul 2011 10:09:58 Hugo Parente Lima wrote: >>>>>On Wednesday 27 July 2011 02:15:35 Gordon L. Kindlmann wrote: >>>Hello, >>>>>>I see from >>>>>>>>>>>>that I can create a QImage around an existing ray image data buffer >>>in >>>memory, communicated by the 'uchar * data' argument, which is what I >>>want.

>>>>>>However, looking at >>>>>>>>>age >>>>>>(which seems to be based on the same documentation) the corresponding >>>PySide constructor seems to take a 'data' argument of type 'uchar'. >>>Is this right? >>>>The docs, no, but you can pass a Python buffer object to the QImage >>constructor. >>>>>Can someone let me know if it possible or not to use PySide to >>>display >>>in-memory image data, referenced by a pointer? The image data is >>>generated by an extension module written in C. >>>>If the value returned by this extension implements the Python buffer >>interface >>it's possible.

Comments are closed.