1
$\begingroup$

I've noticed that when I export plots in Mathematica without a background, a lot of the text ends being made of semi-transparent pixels. For example:

myplot = ContourPlot[Cos[x] + Cos[y], {x, 0, 4 Pi}, {y, 0, 4 Pi}, 
PlotLegends -> Automatic]
Export["Output.png", myplot, Background -> None, ImageResolution -> 150]

Notice how several of the numbers on the axes contain semi-transparent pixels. In general, is there a way to avoid these altogether while still maintaining the transparent background? The final product still has to be a raster image, unfortunately, so SVG or EPS won't be able to save me here.

I also have this problem when I try to use MaTeX, not just in the simple example above. A lot mathematics it renders gets exported with semi-transparent pixels as well.

$\endgroup$
  • $\begingroup$ That's antialiasing. You can use Style[graphics, Antialiasing -> False]. It'll significantly reduce the quality, but I think there's no way around that if you only want black and white pixels. This won't affect text, but it will affect MaTeX output. If you also want to deal with text, export to PDF then use a PDF renderer that can disable antialiasing, such as Ghostscript, to create a raster image. $\endgroup$ – Szabolcs Dec 4 '17 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.