4

I am using standalone to convert a table to PNG. I have followed the following example. I got the output in PNG as well, please see the attached. However, when I view it with any of the image viewers (GIMP, IMAGEMAGICK etc), the background is not white. It has black and white square boxes. Surprisingly, here it is with white background. I will be very thankful if some one tell me the solution.

I have followed the following example

\documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone}
\begin{document}
\begin{tabular}{rrrrrrr}
\hline
        Device & 2011 & 2012 & 2013 & 2014 & 2015 & 2016 \\
        \hline
        Non-smarthphones & 22686 & 55813 & 108750 & 196262 & 357797 & 615679 \\
        Smarthphones & 104759 & 365550 & 933373 & 1915173 & 3257030 & 5221497 \\
        Laptops e Netbooks & 373831 & 612217 & 917486 & 1340062 & 1963950 & 2617770\\
        Tablets & 17393 & 63181 & 141153 & 300519 & 554326 & 1083895\\
        Home gateways & 55064 & 108073 & 180562 & 267545 & 376494 & 514777 \\
        M2M & 23009 & 47144 & 92150 & 172719 & 302279 & 508022 \\
        Altri devices & 525 & 1460 & 5429 & 22966 & 84204 & 242681\\
        \hline
\end{tabular}
\end{document}

Output from the code Screen shot of the GIMP

  • Welcome to TeX.SX! The black and white squares should mean that the PNG has “transparent” background. – egreg Jun 8 '15 at 20:42
  • Thank you egreg for the reply. How can I change the background to white. – Rajagopal Jun 8 '15 at 21:02
5

This is what I call a hack; the standalone class should have a key for passing other options to convert.

\documentclass[
  convert={
    density=300 -alpha deactivate,
    size=1080x800,
    outext=.png
  },
]{standalone}

\begin{document}

\begin{tabular}{rrrrrrr}
\hline
        Device & 2011 & 2012 & 2013 & 2014 & 2015 & 2016 \\
        \hline
        Non-smarthphones & 22686 & 55813 & 108750 & 196262 & 357797 & 615679 \\
        Smarthphones & 104759 & 365550 & 933373 & 1915173 & 3257030 & 5221497 \\
        Laptops e Netbooks & 373831 & 612217 & 917486 & 1340062 & 1963950 & 2617770\\
        Tablets & 17393 & 63181 & 141153 & 300519 & 554326 & 1083895\\
        Home gateways & 55064 & 108073 & 180562 & 267545 & 376494 & 514777 \\
        M2M & 23009 & 47144 & 92150 & 172719 & 302279 & 508022 \\
        Altri devices & 525 & 1460 & 5429 & 22966 & 84204 & 242681\\
        \hline
\end{tabular}
\end{document}

enter image description here

  • Thank you very much. It worked. \documentclass[ convert={ density=300 -alpha deactivate -background white, size=1080x800, outext=.png }, ]{standalone} – Rajagopal Jun 8 '15 at 21:35
  • @egreg Neither the answer nor the answer with the additional "-background white" produce a white background—at least not with TeX Live 2015. The background remains transparent in both cases. – Calaf Jun 29 '16 at 16:24
  • @Calaf I get white background. What OS are you on? – egreg Jun 29 '16 at 19:44
  • @egreg I'm on OS X 10.11.5 (El Capitan). – Calaf Jun 29 '16 at 20:03
  • @Calaf I'm too. – egreg Jun 29 '16 at 20:11

Your Answer

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

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