I'm trying to understand this code, however I'm unable to deduce the meaning of reds and trans. I would be glad if you can help with it:

import sys
import Image

# pixel constants in hex
# reds most to least, the last is trans and used as a noise factor
reds=("\xf1\x34\x00\xff" , "\xfa\x00\x2f\xff",
   "\xf1\x36\x36\xff", "\xfe\x74\x74\xff", "\xfe\xc3\xc3\xff",
   "\xf9\xcb\xcb\xff", "\xf1\xd3\xd3\xff", "\x00\x00\x00\x00")

The complete code is at: https://matsu-project.googlecode.com/svn-history/r28/trunk/streaming-image-processing/src/reduce.py


1 Answer 1


The numbers appear to be RGBA values: red, green, blue, and alpha (transparency).

reds appear to be mostly red-tinted colors (except the last entry, which is a completely transparent item).

trans is the transparent "color".


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.