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?
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 is 511
.
n = 257;
While[(Rasterize[Graphics[{RGBColor[0, 0, 0], Disk[]}]] ===
Rasterize[Graphics[{RGBColor[0, 0, 1/n], Disk[]}]]) != True,
n++];
Print@n
Out[1]=511
There is a difference between the two images for n<511
p1 = ImageData@Rasterize[Graphics[{RGBColor[0, 0, 0], Disk[]}]];
p2 = ImageData@Rasterize[Graphics[{RGBColor[0, 0, 1/257], Disk[]}]];
ArrayPlot[p1 - p2]
This difference is constant all the way through n=510
and is equal to 1/255
.
Max[p2 - p1] === N[1/255]
Out[1]=True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With