tags:

views:

95

answers:

1

I'm trying to output a TrueColor image using GD (specifically bgd.dll) from a C++ program under windows. The API (or at least the examples) seem to suggest that the range of the integer RGB arguments for gdResolveColor spans the values 0-255. Is this correct?

I've experimented with higher values and gotten strange results but this could well be to due my own lack of understanding.

+1  A: 

That is correct. True color uses one byte for each color component (red, green and blue). The range of an byte is 0 to 255, hence the range indicated in the GD documentation. So, 16,777,216 (2^24 or 256^3) different colors can be specified using these 3 bytes (24-bits).

I'm not sure how GD handles invalid inputs (i.e. a color component over 255). It likely masks the input and you end up with the your submitted value modulo 255.

Judge Maygarden
This was me getting my permutations and combinations mixed up.
DuncanACoulter