CAUTION/Disclaimer: execution of some of the code below can result in a complete crash of Mathematica or even your system. Save all your work and do not try in a productive situation.
For a graphical application, I need to export graphics containing several hi-res textures at large image sizes.
Consider the following (minimal example) code wich is largely harmless:
Graphics[{Texture[Graphics[Circle[]]],
Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]},
ImageSize -> 400]
But upping ImageSize
past a given (probably hardware-dependent, in my case ~4000) threshold will crash the frontend+kernel
Graphics[{Texture[Graphics[Circle[]]],
Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}},
VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]},
ImageSize -> 4000]
To make things worse, this also seems to depend on the graphics driver version. I use a NVIDIA GTX 485M card, and with the 296.10 driver, I can go up to about ImageSize -> 8000
while with any newer driver version the system stalls at ImageSize -> 4000
.
Does anyone know a workaround? Always reverting to an obsolete driver (which e.g. does not work with CUDALink
anymore) is not optimal.
Addendum: Question, Part Two
As pointed out by @cormullion, setting the global preferences for the antialiasing quality in the Preferences dialog helps already a lot and allows much larger ImagesSize
s.
Now, how to go about setting/resetting the value of HardwareAntialiasingQuality
programmatically?
Answer
I've had problems when pushing images above a certain size. For example, it's ok at 1500:
DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3},
ColorFunction -> "SunsetColors", ImageSize -> 1500]
But pushing it too far:
DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3},
ColorFunction -> "SunsetColors", ImageSize -> 2000]
While I quite like the effect, in an artistic kind of way, clearly Mathematica is reaching into regions of the computer's memory that it shouldn't be. I can see glimpses of other apps, previously opened documents, and so on. (This was a fresh kernel.)
I've had this on versions 8 and 9, and was about to conclude that my computer was going wrong. However, on a hunch, I reset the Antialiasing prefs from Highest down to No Antialiasing, and now the problem doesn't occur very often.
I must have set it to High for some reason, and forgot that larger images would probably stress it too much.
Your problem may be related!
Comments
Post a Comment