Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to output a PNG image with the standalone package. Here is a minimal working example:

\documentclass[preview, convert={density=300}]{standalone}

    Hello world

When I inspect the file properties of the resulting PNG file, I still get 72 dpi. Even without using the preview option, it's still at 72 dpi. However, if I convert to JPG using convert={density=300, outext=.jpg}, I'd get 300 dpi.

How can this be fixed? My particular requirement would be to use the preview option and use the PNG image format.

share|improve this question
If I set density=600 in the options, I get PNG image data, 415 x 58 which is twice as the 208 x 29 that you get from the original input. The typeset "Hello world" is 50.02786pt wide, which corresponds to 0.69224in; 300*0.69224=207.672 that justifies the 208 pixels (and also the 415 at 600dpi). –  egreg Nov 13 '12 at 21:34
Please check if standalone is using Image Magick or Ghostscript internally. Image Magick is the default under Linux if installed. See the manual section 4.6.2 Conversion software for more details. Also please state your standalone version, your LaTeX distribution and your OS. –  Martin Scharrer Jan 1 '13 at 11:42
@egreg: Could you recheck with the ghostscript option also set. I guess the installation of the OP uses Ghostscript which might cause the issue. –  Martin Scharrer Jan 1 '13 at 11:43
@MartinScharrer I get the same result with ghostscript: \documentclass[preview, convert={ghostscript,density=300}]{standalone} gives PNG image data, 208 x 29, 8-bit/color RGB, non-interlaced –  egreg Jan 1 '13 at 14:16
@MartinScharrer With the ghostscript option set, even my image viewer does agree about the density. –  Qrrbrbirlbel Jan 1 '13 at 19:26
add comment

1 Answer

The package manual states that “the following default settings are used: PNG format, a density of 300dpi, no explicit size […].”

So there's no surprise that density=300 doesn't result in a different output.

I wouldn't trust the “file properties” of the resulting file. How should a picture viewer (or your OS) know what an inch is? It's just pixels at the output side now.

Consider the following example where I typeset a black 1 inch by 1 inch square.

The output .png is 300 pixels by 300 pixels.


    convert% uses default settings: density=300 and png



enter image description here

To complement egreg's comment:


\newlength{\myWidth} \newlength{\myHeight}
\sbox0{Hello world}
\printlength\myWidth${}\times{}$\printlength\myHeight\ (\the\wd0 ${}\times{}$\the\ht0)


enter image description here

share|improve this answer
Could you recheck with the ghostscript option also set. I guess the installation of the OP uses Ghostscript which might cause the issue. See also my comment to the question. –  Martin Scharrer Jan 1 '13 at 11:43
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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