0

The journal I'm going to submit a paper requires .tiff format for images. I'm trying to add .tiff in latex, and I've found a thread: Add tif image to LaTeX.

However, I cannot add image from .tiff, and I don't know how to resolve it. I just added

\usepackage{epstopdf}
\epstopdfDeclareGraphicsRule{.tif}{png}{.png}{convert #1 \OutputFile}
\epstopdfDeclareGraphicsRule{.tiff}{png}{.png}{convert #1 \OutputFile}
\AppendGraphicsExtensions{.tif,.tiff}

but I got a message

'convert' is not recognized as an internal or external command, operable program or batch file.

and error

'filename-tiff-to-png' not found

The epstopdf works well for .eps file, and my guess is that I miss something about the convert in the line \epstopdfDeclareGraphicsRule{.tif}{png}{.png}{convert #1 \OutputFile}.

Any help would be appreciated.

Young
  • 1
  • Do you have ImageMagick (which provides the convert command) installed? – frabjous Mar 08 '22 at 02:44
  • I'd also recommend changing convert to convert -layers flatten in case the .tiff/.tif file has multiple layers. – frabjous Mar 08 '22 at 02:56
  • Do you have to submit the .tif files in addition? Because (La)TeX cannot work natively with them: you will have to convert to either .png or .pdf at some point. It would probably be easiest if you simply did that by hand, as it were. – Ingmar Mar 08 '22 at 06:29
  • @frabjous I just installed ImageMagick with convert, but it is still not recognized. Is there anything I should do after installing ImageMagick? Thanks – Young Mar 08 '22 at 15:29
  • @Ingmar Yes I need to submit the .tif files. Btw, it is my understanding that using the epstopdf is an easy way to automatically convert .tif to .png. Is there another way easily do that? – Young Mar 08 '22 at 15:32
  • @Young Yes, you should be able to use the epstopdf package to call convert to do the conversion on the fly. With -layers flatten added after convert, your code above works for me (when pdflatex is called with --shell-escape anyway) Can you use convert from the command line? My guess is that LaTeX can't find convert because it's not in your PATH.. But I'm on Linux, and convert is automatically added to my PATH when I install it. Especially if you're on Windows, you may need to do some work to add the folder with the convert executable to your PATH. Post the log file if you can. – frabjous Mar 08 '22 at 16:15
  • @frabjous I've added --shell-escape and -layers flatten but it still there. Also, I've tried to add path of ImageMagick to Windows Environment Variable Path, but it seems not working. You must be able to see the log file here: link – Young Mar 08 '22 at 18:06
  • Again, can you run use convert from the command line? I'm not that familiar with MikTeX, since I use TeXlive, but you may need to do more to get shell-escape/write18 working. See here. – frabjous Mar 09 '22 at 01:21
  • @frabjous Yes, I can use convert from the command line, and it actually converts the image file. One thing I'm confused is that I got an error message that convert not found only when I added --shell-escape flag. Without the flag, I don't get the message but it still not converted. My understanding was that it should be opposite, right? – Young Mar 09 '22 at 04:29
  • I guess it doesn't even try to do the conversion if --shell-escape isn't there. Have you tried putting the full path C:\path\to\whatever\convert.exe in place of convert in the code? (You may need to escape the backslashes.) If you're not changing the .tiff a lot, I would just use the .png you already got by converting, and save the .tiff as well to send to the journal. – frabjous Mar 09 '22 at 04:44
  • 1
    @frabjous Wow, adding the full path in the command works. Apparently, my latex editor doesn't have access to the convert for some reason. I really appreciate all of your help! – Young Mar 09 '22 at 05:17

0 Answers0