Skip to main content
2 of 3
added 6 characters in body; edited tags
Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375

Is it possible to render Graphics with more than "Byte" bitdepth?

I wonder is it possible to render Graphics in Mathematica with bitdepth higher than "Byte" which is the maximum bitdepth supported by the Windows XP operating system? Tracing the rasterization with the option TraceInternal->True shows that Graphics is always rendered to a matrix of Integers in the range from 0 to 255, then it may be converted to Reals if requested but such conversion does not increase the bitdepth, of course: it changes only the internal representation of the Image. For example, let us consider rendering of VertexColors:

Cases[Trace[
  Image[Graphics[
    Polygon[{{-1, 0}, {1, 0}, {0, Sqrt[3]}}, 
     VertexColors -> {Red, Green, Blue}], ImageSize -> 4], "Real"], 
  TraceInternal -> True], 
 x_List /; MatrixQ[Unevaluated@x, NumberQ], {1, Infinity}]

One can see matrixes of values between 0 and 255 in spite of requested "Real" bitdepth. Let us compare the results of rendering with different requested bitdepths:

In[21]:= Image[
  Graphics[Polygon[{{-1, 0}, {1, 0}, {0, Sqrt[3]}}, 
    VertexColors -> {Red, Green, Blue}], ImageSize -> 4], "Real"] === 
 Image[Image[
   Graphics[
    Polygon[{{-1, 0}, {1, 0}, {0, Sqrt[3]}}, 
     VertexColors -> {Red, Green, Blue}], ImageSize -> 4], "Byte"], 
  "Real"]

Out[21]= True

It is obvious that the requested bitdepth does not change the real rendering bitdepth.

So the question is: is it possible to render Graphics with bitdepth higher than Byte?

Alexey Popkov
  • 62.3k
  • 7
  • 154
  • 375