Color components and endianess
tom nygen
ca95129 at hotmail.com
Mon Jun 14 11:25:20 EDT 2010
Hi Adam,
On 6/11/2010 8:32 PM, Adam Goode wrote:
> On 06/11/2010 08:16 AM, tom nygen wrote:
>
>> Thank you for making OpenSlide available. It is very useful for me to
>> deal effectively with multiple scanner manufacturers. I've just tried
>> some examples and have the following questions:
>>
>>
> Glad it's working well for you!
>
>
>> 1. There seems to be only one pixel data format retrieved from the
>> slides and that is pre-multiplied ARGB. Since most of the slide formats
>> (known to me) have no alpha channel, and if they do, RGB components are
>> already pre-mulitplied with the alpha channel, why can't we use RGB
>> (24-bit) instead of ARGB (32-bit) format when we get a region from the
>> slide? This would ease integration for many people having codes handling
>> 24-bit RGB format.
>>
>>
> In OpenSlide, we set the alpha channel to 0 when we are beyond the edge
> of the slide. For some formats, including MIRAX, the alpha channel is
> set to 0 where we don't have any data. I'm attaching an example PNG file
> to illustrate this.
>
>
>
I see your point with the ARGB format.
We have a problem with Mirax slides that we are still investigating. The
same regions retrieved from the manufacturer Windows native API and from
OpenSlide are very much different in term of color level. Once we know
where the problems are, we may provide you with a test case.
>> 2. Since there could be an endian issue from one platform to the other,
>> are there macros helping to make it easier to retrieve color components
>> R, G, B from the 32-bit pixel data?
>>
>>
> Hmmm, there should be no endian issue here, the data is stored in native
> endian format. This psuedo-code illustrates that:
>
> a = (pixel& 0xFF)>> 24
> r = (pixel& 0xFF)>> 16
> g = (pixel& 0xFF)>> 8
> b = pixel& 0xFF
>
> Note that this means there is one 32-bit word per pixel, not four 8-bit
> bytes.
>
>
Thank you for the method to extract the components (I got your corrected
version).
Regards,
Tom
> Have fun with OpenSlide,
>
> Adam
>
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.andrew.cmu.edu/pipermail/openslide-users/attachments/20100614/35f60c2b/attachment.html
More information about the openslide-users
mailing list