> hi
> i was trying to get the rgb components of a pixel from an RGB jpeg
[quoted text clipped - 18 lines]
> how to do this
> dn
The pixel value is the value of a packed-ARGB component (typically), so
that it will look like AARRGGBB (each letter represents a hexadecimal
digit). The alpha component is 0xff (fully opaque) here, which is why
you are getting a negative integer value. If you don't care about the
opacity, set it equal to 255 (0xff).
int px = (alpha << 24) | (red << 16) | (green << 8) | blue can reform a
pixel value, assuming that the values are already clipped to [0..255].

Signature
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Andrew Thompson - 20 Oct 2007 15:08 GMT
...
>> i was trying to get the rgb components of a pixel from an RGB jpeg
...
>The pixel value is the value of a packed-ARGB component (typically), so
>that it will look like AARRGGBB (each letter represents a hexadecimal
[quoted text clipped - 4 lines]
>int px = (alpha << 24) | (red << 16) | (green << 8) | blue can reform a
>pixel value, assuming that the values are already clipped to [0..255].
Well sh*t hey. These byte conversions still leave me
'flumoxed'. Don't suppose you'd care to share an SSCCE
that does what you are talking about - 'in code'?
(In case there is any misunderstanding, there is no sarcasm
intended in the above statements - but OTOH, I am drinking
Scotch, and still slightly irritated at the OP for *not* posting
compilable code..)

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Lew - 20 Oct 2007 15:18 GMT
> still slightly irritated at the OP for *not* posting
> compilable code..)
In this case the question was about what idiom to use for an intended purpose,
not what was wrong with an existing snippet, so SSCCE didn't apply.

Signature
Lew
Andrew Thompson - 21 Oct 2007 03:28 GMT
>> still slightly irritated at the OP for *not* posting
>> compilable code..)
>
>In this case the question was about what idiom to use for an intended purpose,
>not what was wrong with an existing snippet, so SSCCE didn't apply.
Agreed. In fact that was probably the source of my
(mild) irritation. I'd have mucked about with the code
if the problem *had* justified an SSCCE, and included
runnable code!

Signature
Andrew Thompson
http://www.athompson.info/andrew/
devnew@gmail.com - 20 Oct 2007 18:06 GMT
The alpha component is 0xff (fully opaque) here, which is why
> you are getting a negative integer value. If you don't care about the
> opacity, set it equal to 255 (0xff).
>
> int px = (alpha << 24) | (red << 16) | (green << 8) | blue can reform a
> pixel value, assuming that the values are already clipped to [0..255].
thanx joshua..
setting alpha=0xFF and then alpha << 24) | (red << 16) | (green << 8)
| blue gets me the orig value..
also
can anyone advise me where to get more about the color schemes and
bitlevel info ..i am a beginner to this area..
thanx again
dn