Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6019589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:26:37+00:00 2026-05-23T03:26:37+00:00

This is most likely a bug in Mathematica 8.0.1 and maybe other versions too.

  • 0

This is most likely a bug in Mathematica 8.0.1 and maybe other versions too. Lets try the following:

Table[
 Export[
  "Res_" <> ToString[r] <> ".png", Rasterize[
  Style[x^2 + y^2, 40],
  Background -> None,
  ImageResolution -> r
 ],
 Background -> None],
 {r, {20, 40, 100, 300, 400, 500, 600}}
]

This is a screen shot of what I obtain:

Output

First thing to notice is that the last two pictures are the wrong size. This is fine to some extent since I’m satisfied with a resolution of 300 or above. Now look at this:

in = 72;
G3D = Graphics3D[AspectRatio -> 0.925, Axes -> {True, True, True}, 
  AxesEdge -> {{-1, -1}, {1, -1}, {-1, -1}}, AxesStyle -> Directive[10, Black],
  BaseStyle -> {FontFamily -> "Arial", FontSize -> 12}, Boxed -> False,
  BoxRatios -> {1, 1, 1}, LabelStyle -> Directive[Black], 
  ImagePadding -> All, ImageSize -> 5 in, PlotRange -> All,
  PlotRangePadding -> None, TicksStyle -> Directive[10], 
  ViewPoint -> {2, -2, 2}, ViewVertical -> {0, 0, 1}, Background -> None
];
surf = Show[
  Graphics3D[Sphere[{0, 0, 0}, 1], Background -> None, 
  AxesLabel -> {"x", "y", "z"}], Options[G3D]
];
fig = Show[surf, AxesStyle -> Directive[Opacity[0]], 
  Background -> None
];

I wish to Export fig as a png file with transparent background with a high resolution. Here goes my lame attempt with the always buggy Mathematica.

Table[
  Export[
    "Res_" <> ToString[r] <> ".png",
    Rasterize[fig, ImageResolution -> r, Background -> None],
    Background -> None
  ], {r, {20, 40, 100, 300, 400, 500}}
]

Here is a screenshow of a few png files.

Images

All of them came out with the expected resolution :). But what happened to my transparent background? I have specified many times through my code Background -> None and yet this doesn’t want to work. I looked around the web and I found this:

http://forums.wolfram.com/mathgroup/archive/2009/Feb/msg00943.html

Lets use this idea.

bgImage = Image[ConstantArray[{0, 0, 0, 0}, Reverse[ImageDimensions[fig]]], 
  ColorSpace -> "RGB"];
compImage = ImageCompose[bgImage, fig];
Table[Export["Res_" <> ToString[r] <> ".png", 
  Rasterize[compImage, ImageResolution -> r, Background -> None], 
  Background -> None], {r, {20, 40, 100, 300, 400, 500}}]

Images

No backgrounds!!! 🙂 Great. But what happened to the sizes of my images? The resolution is increasing but the image size started to decrease. I have really been messing around with this problem for too long now. I hope one of you can shed some light into this Mathematica bug and can find a hack in order to achieve a transparent background PNG with high resolution. Please mention the Mathematica version you guys are using if you find an answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:26:38+00:00Added an answer on May 23, 2026 at 3:26 am

    First of all: do not use ImageResolution when exporting! This buggy options is useless most of the time and does not do what one can expect. It works as an analog of ImageSize.

    Instead, use Magnify command and Magnification option of Style. They do what we want to get from ImageResolution!

    Now about the reason for the behavior showed in the first part of the question. Yes, it happens. And yes, it is machine-dependent. Is it a bug? Yes, at least a great imperfection. It it completely unexpected? As for me – not.

    It seems that the source of the problem is that rendering of graphics is in really made by the FrontEnd and the latter uses default settings for Cell when converting graphics to raster.

    In[1]:= Options[Cell, PageWidth]
    Out[1]= {PageWidth -> WindowWidth}
    

    Lets try to see how output of

    Table[Rasterize[Style[x^2 + y^2, 40], Background -> None, 
      ImageResolution -> r], {r, {300, 400, 500, 600}}]
    

    looks at different run-time sizes of the notebook window:

    enter image description here

    One can see the obvious dependence of the output on the notebook window size.

    A workaround is to pass PageWidth directly to Cell:

    Rasterize[
     Cell[BoxData@ToBoxes@Style[x^2 + y^2, 40], PageWidth -> Infinity], 
     ImageResolution -> 600]
    

    enter image description here


    P.S. In addition. The only case I know when ImageResolution works as expected is PDF export with "AllowRasterization"->True:

    First@ImportString[
      ExportString[Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}], "PDF", 
       "AllowRasterization" -> True, ImageResolution -> 200], "PDF"]
    

    But it does not allow to specify transparent background.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is most likely the culprit for this page: http://www.mypicx.com/04192010/ff/ table { border-collapse:collapse; }
This is most likely not an easy one but here is the situation: I
I know this is most-likely a simple question but when you restore a database
I'm pulling in xml using the cocoa NSXmlParser. Since this process most likely won't
I guess this is an odd one, and the answer is most likely it
This is not as simple as it seems. Most of you are likely thinking
I am having this most annoying issue when I try to rebuild my solution
I am new to using Grails plugins and this is most likely a novice
This is most likely possible, but I want to style the main page using
this is most likely a simple answer that i have overlooked.. I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.