10
$\begingroup$

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 ImagesSizes.

Now, how to go about setting/resetting the value of HardwareAntialiasingQuality programmatically?

$\endgroup$
3
  • $\begingroup$ What's your Antialiasing preference set to? I had more frequent crashes with this set to medium or high, but far fewer when set to lowest. $\endgroup$
    – cormullion
    Commented Feb 4, 2013 at 8:50
  • $\begingroup$ @cormullion Cool - setting Antialiasing to None in the Preferences dialog helps working with much larger sizes. Please consider an answer. $\endgroup$
    – Yves Klett
    Commented Feb 4, 2013 at 9:17
  • $\begingroup$ Since you were the last to pipe up on meta, I'm using your question as a guinea pig to test out the new close options =) Brace yourself for a close storm and/or additional comments :D $\endgroup$
    – rm -rf
    Commented Jun 26, 2013 at 18:45

1 Answer 1

4
$\begingroup$

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]

ok plot

But pushing it too far:

DensityPlot[Sin[x] Sin[y], {x, -4, 4}, {y, -3, 3}, 
  ColorFunction -> "SunsetColors", ImageSize -> 2000]

not ok plot

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.

prefs

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!

$\endgroup$
10
  • $\begingroup$ What would be the most convenient way to locally turn off antialiasing without resorting to the preferences menu? $\endgroup$
    – Yves Klett
    Commented Feb 4, 2013 at 9:48
  • 2
    $\begingroup$ @yves FrontEnd Options contains "RenderingOptions -> {"HardwareAntialiasingQuality" -> 0.}", perhaps you can explore that? $\endgroup$
    – cormullion
    Commented Feb 4, 2013 at 10:01
  • $\begingroup$ Correct - I just cannot remember the correct way to set that option (if I ever knew that firstplace). Thought it was around, but cannot find it. $\endgroup$
    – Yves Klett
    Commented Feb 4, 2013 at 10:23
  • $\begingroup$ What OS do you see this happen on ? $\endgroup$
    – rcollyer
    Commented Feb 4, 2013 at 14:51
  • $\begingroup$ @rcollyer I'm on Mac $\endgroup$
    – cormullion
    Commented Feb 4, 2013 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.