# Conversion problem using standalone and imagemagick

I'm trying to convert a table to png format using Imagemagick

\documentclass[12pt,a4paper,border=8pt,convert=true]{standalone}

\usepackage{booktabs}
\usepackage{caption}
\usepackage{siunitx}
\sisetup{binary-units = true,
table-format=7.0}

\begin{document}

\minipage{1.08\textwidth}
\begin{tabular}{lS[table-format=6.0]
S[table-format=6.0]
S[table-format=6.0]
SSS}
\toprule
Device & 2011 & 2012 & 2013 & 2014 & 2015 & 2016 \\
\midrule
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\\
\bottomrule
\end{tabular}
\captionof*{table}{Traffico mobile globale al mese per dispositivo in \si{\tera\byte}}
\endminipage

\end{document}


Here it is the table create using standalone package. I read the documentation and it says to use ImageMagick. The problem is when I compile it doesn't find the exacutable imgconvert.exe. So I put this exacutable into folder where there is tex file. Now when I compile I got another error:

imgconvert.exe: %s' (%d) "gswin32c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE
-dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2
"-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r300x300"
"-sOutputFile=C:/Users/MAZZAR~1/AppData/Local/Temp/magick-31681PKeFVHE065o"
"-fC:/Users/MAZZAR~1/AppData/Local/Temp/magick-3168A-Fab6j3iIUc"
"-fC:/Users/MAZZAR~1/AppData/Local/Temp/magick-3168QXzuvG_UAP07"
@ error/utility.c/SystemCommand/1890. imgconvert.exe: Postscript delegate failed
table.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/678.
imgconvert.exe: no images defined table.png' @ error/convert.c/ConvertImageCommand/3066.

• convert is also the MS tool for FAT to NTFS conversion of harddrives, therefore the recommendation is to rename Image Magick's convert.exe to imgconvert.exe. In order not to be blamed for any data loss due to my standalone package (even if this is very unlikly) I put the default executable name to imgeconvert. This can be change using the convert={convertexe={convert.exe}} class option. This all is also described in detail in the standalone manual. – Martin Scharrer Jan 18 '13 at 15:28
• I don't recognise the error you get, but I didn't tested standalone much under MS Windows. I developed it under Linux and there it works well. I fixed some quoting issues with Windows, one actually very recently. Maybe there is a similar issue here. I will try to debug this at my Windows machine soon. – Martin Scharrer Jan 18 '13 at 15:30
• Also, bugs with standalone should be reported to the package bug tracker. (There is one for each of my packages.) Bug reports should not be posted here, see Questions which are bug reports on Meta for the discussion about it. – Martin Scharrer Jan 18 '13 at 15:33

First, about the trouble with the executable name:

convert is also the MS tool for FAT to NTFS conversion of harddrives, therefore the recommendation is to rename Image Magick's convert.exe to imgconvert.exe. In order not to be blamed for any data loss due to my standalone package (even if this is very unlikly) I put the default executable name to imgconvert. This can be change using the convert={convertexe={convert.exe}} class option. This all is also described in detail in the standalone manual.

I would recommend Windows users to either rename or copy the convert.exe file to imgconvert.exe or change the standalone.cfg file to include:

 \standaloneconfig{convert={convertexe={convert.exe},false}}


Now to the error message you get:

I tried this under Windows and found out that it depends on the version of Image Magick. With v6.6.9 I get the same error. Here it doesn't matter if it is called from standalone or manually from the command line. However with v6.8.1 I just downloaded today from http://www.imagemagick.org/script/binary-releases.php#windows it works without any issues (after selecting the right executable name as mentioned above). It seems there is an issue with PDF using v6.6.9 and maybe other versions after it before v6.8.1.

Therefore the fix for your problem is to update Image Magick. If this doesn't fix your issue, or if you already have v6.8.1 installed, then please post the used version number here. Also try to convert it manually using the command line convert.exe -density 300 file.pdf -quality 90 file.png. If this also throws the same error it isn't an issue with standalone but only with ImageMagick.

• Please, is imgeconvert a misspell of imgconvert or not? – yo' Apr 9 '14 at 10:31
• @yo': Sorry, yes I misspelled that one. I fixed it now. – Martin Scharrer Feb 15 '18 at 11:34

For some reasons, I too get the same error and was never able to use standalone directly for conversion (I am on windows). It is because the name of the executable is simply convert.exe whereas the standalone searches for imgconvert.exe. :-( I just took a copy of convert.exe and renamed it as imgconvert.exe and put it back in the installation folder of imagemagick. Then your code works fine.

If it is not working for you, then the most possible reason (as is evident from your error report) is the imgconvert.exe is not in the system's path as a result of which it is not found. Try to add it to your system path or reinstall imagemagick (while doing that it will ask you whether you want to add it to the path).

Here is another method to get png files. But for this also convert.exe (here only convert.exe) must be in system's path. Otherwise this won't work!

(Compile with pdflatex):

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{mytable.tex}
\documentclass[12pt,a4paper,border=8pt,convert=true]{standalone}

\usepackage{booktabs}
\usepackage{caption}
\usepackage{siunitx}
\sisetup{binary-units = true,
table-format=7.0}

\begin{document}

\minipage{1.08\textwidth}
\begin{tabular}{lS[table-format=6.0]
S[table-format=6.0]
S[table-format=6.0]
SSS}
\toprule
Device & 2011 & 2012 & 2013 & 2014 & 2015 & 2016 \\
\midrule
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\\
\bottomrule
\end{tabular}
\captionof*{table}{Traffico mobile globale al mese per dispositivo in \si{\tera\byte}}
\endminipage
\end{document}
\end{filecontents*}
% compile with pdflatex
\immediate\write18{pdflatex --shell-escape mytable}
% convert to PNG
\makeatletter
\immediate\write18{convert -density 500 -alpha on mytable.pdf mytable-\@percentchar02d.png}
\makeatother
%
\begin{document}
Check the folder for your \verb|mytable-00.png| file.
\end{document}


Your code is in between \begin{filecontents*} and \end{filecontents*}. You must have imagemagick installed and the executable should be in the system path for this to work.

• I pasted your code and runned it. It works but no file png has been created. I put in the same folder of tex file imgconvert.exe. This is the result in the log: LaTeX Warning: Overwriting file ./mytable.tex'. \openout15 = `mytable.tex'. LaTeX Warning: Tab has been converted to Blank Space. runsystem(pdflatex --shell-escape mytable)...disabled (restricted). runsystem(convert -density 500 -alpha on mytable.pdf mytable-%02d.png)...disabl ed (restricted). – Mazzy Jan 15 '13 at 13:15
• I download imagemagick and installed it. After I renamed the exacutable to imgconvert.exe and put in the same folder of main tex file. When I execute no error appear but I got this warning that don't let me have png file. I checked the rights and I think I have access correctly – Mazzy Jan 15 '13 at 13:28
• I have to include shell-escape to pdflatex? – Mazzy Jan 15 '13 at 13:31
• Yes I got that big list...but It still doesn't work – Mazzy Jan 15 '13 at 13:34
• @Mazzy Check if imagemagick is in system's path. See the edit. – user11232 Jan 15 '13 at 15:12

The error message tells you that "gswin32c.exe" cannot be found. Install Ghostscript and the problem should be resolved.