[Tex/LaTex] Conversion problem using standalone and imagemagick

conversionerrorsstandalone

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}
    \addtolength{\tabcolsep}{-1.0pt}
    \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.

Best Answer

First, about the trouble with the executable name:

convert is also the MS tool for FAT to NTFS conversion of hard disk drives, 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 unlikely) 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 here 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.

Related Question