I was amazed when I found that Mathematica gives True
for the following code (on 32 bit Windows XP with Mathematica 8.0.1):
Rasterize[Graphics[{RGBColor[0, 0, 0], Disk[]}]] ===
Rasterize[Graphics[{RGBColor[0, 0, 1/257], Disk[]}]]
What is the minimal difference in RGB color values which Mathematica renders and exports as different colors? Is it machine-dependent?
Looks like
Rasterize
rounds each pixel's R G B channels to the closest 8bit value (to the closest1/256
).So the minimal difference, rasterizing into different colors should be around 0.000000000000000000000000000...
Guilty party here is Rasterize, which chops off color precision. Get help on
ImageType[]
to see that Mathematica actually recognizes other bit depths, but Rasterize[] vandalizes anything beyond Byte.I believe this behaviour is machine dependent, but I do not know how exactly it depends on the OS. On my machine, it evaluates to
True
only when the denominator is511
.There is a difference between the two images for
n<511
This difference is constant all the way through
n=510
and is equal to1/255
.