Why is the imagedata value different from Win32 to MacOS platforms?
Ben Rubinstein
benr_mc at cogapp.com
Thu Jul 27 19:30:14 EDT 2006
On 25/7/06 15:04, Joel Guillod wrote:
> For image processing I have to extract the RGB values from an imagedata
> of an image but I got different results under MacOSX and Win32.
> I found that the imagedata values is different between the two platform:
> every color component of pixels is slighty changed. I have not found in
> the documentation such a change depending on the platform. Notice that
> <the text of image> is identical between both platform.
>
> Could anyone give me a clue?
Joel,
Is it possible that your Mac and Windows platforms were at different depths?
I did a few tests, and noticed that the histogram of an image imported under
Windows was much 'cruder' than the same image imported under Mac. It occured
to me that Windows was using some cheaper algorithm to expand the JPEG data,
not using as many bits per pixel. Then I checked, and found that my Windows
machine (actually a VPC on my Mac running in 24-bit) was in 16-bit colour.
When I changed the Windows one to 24 bit, they had the same imageData.
So - unless you tell me that they were both set to 24-bit colour - I think
there's a perfectly straightforward explanation.
The image is imported from a JPEG file; Rev stores the actual JPEG data as the
'text' of the image, ie what gets actually saved in the stack file. When the
image is displayed, it is rendered into a buffer, which is probably the same
depth as the screen (or alternatively, perhaps the buffer is always 24-bit,
but the JPEG expansion code operates in a way based on the screen depth).
Either way, when you ask for the imageData, you're getting a 5-bits per
channel pixmap expanded to 8-bits per channel - hence the slight differences.
Ben Rubinstein | Email: benr_mc at cogapp.com
Cognitive Applications Ltd | Phone: +44 (0)1273-821600
http://www.cogapp.com | Fax : +44 (0)1273-728866
More information about the use-livecode
mailing list