0

I am writing a thesis on XeLaTeX and I will be using a lot of .tif files. I always get errors because apparently it is not supported. I tried changing the files name to .png, it allows me to see the image on Preview but it still doesn't show on the recompiled pdf. Since I will be using a lot of .tif pictures, it is really hard for me to change all of them manually to png, or any other format. I wanted to ask if there is a command/package that I can use to continue working with my .tif images? I dont mind converting them to jpg, png or pdf. I checked similar questions but when testing the answers I even got more errors. I appreciate any help! Thank you.

  • you should be able to change all the tiff to png locally on a single commandline before uploading to overleaf, in bash for i in *.tif; do convert $i ${i/.tif/.png} ; done would convert them all for example. – David Carlisle Feb 03 '21 at 15:41
  • 2
    what is generating the tif files? Can it not be configured to generated png instead? – David Carlisle Feb 03 '21 at 15:42
  • @DavidCarlisle I am not sure I get what you mean. Can you explain it? Sorry I am not good with computers :D I am using a Macbook btw.

    also the images are created with SEM-Microscope, I dont think .png is supported on SEM's software.

    – user231849 Feb 03 '21 at 15:52
  • so you could use that command in the mac terminal (whether that is bash or fish or whatever) it assumes that you have imagemagic convert installed to convert between image formats – David Carlisle Feb 03 '21 at 15:58
  • I don't have a mac but for example this answer suggests a way, if you convert all your files to jpg then pdftex can include them easily (faster than including png) https://stackoverflow.com/questions/7179979/via-command-line-convert-tif-and-pdf-to-jpg-or-png – David Carlisle Feb 03 '21 at 16:12
  • @DavidCarlisle thank you so much. I now converted all of my images. :) – user231849 Feb 03 '21 at 16:50
  • 1
    There is also this technique with shell escape, but I'd recommend to convert all the files yourself. If there are too many, you might want to use some kind of an "outside" solution, such as Makefiles. – Oleg Lobachev Jun 28 '22 at 21:09

1 Answers1

1

If you convert all your images to jpg then they can be more easily included, I would suggest doing this locally before uploading to your Overleaf project.

On a mac

https://stackoverflow.com/questions/7179979/via-command-line-convert-tif-and-pdf-to-jpg-or-png

Suggests a way of batch converting a collection of tif files.

On linux (or windows with a suitable shell) if you have image magic convert a simple loop such as

for i in *.tif; do convert $i ${i/.tif/.jpg} ; done

would convert all the files in the current directory.

David Carlisle
  • 757,742