Thursday, May 2, 2024
103
rated 0 times [  103] [ 0]  / answers: 1 / hits: 85315  / 2 Years ago, tue, october 18, 2022, 3:07:42

I'm trying to mass convert a handful of .tif files. I found phatch could look like a good candidiate but I'm running Ubuntu 11.04. Looks like they don't have a .deb for my version.



Anyone have any alternatives to phatch or any other recommendations as to quickly batch convert tif to jpeg files.



I'm looking for a non-Photoshop (ala Wine) solution.


More From » image-processing

 Answers
2

Easy. Install imagemagick:


sudo apt install imagemagick

Its simplest usage is:


convert File.tif File.jpg

It is smart and goes by your file extension.


Now, for doing batch conversions, we shall use a loop.


cd into the directory where your tif files are.


then:


for f in *.tif; do  echo "Converting $f"; convert "$f"  "$(basename "$f" .tif).jpg"; done

Read also as:


for f in *.tif
do
echo "Converting $f"
convert "$f" "$(basename "$f" .tif).jpg"
done

That should do it!


Also, once you convert all of the files and verify the new jpg's integrity, just run rm *.tif in that directory to delete all your old .tif files. Be careful with asterisks though, don't add a space after the *, or you will delete all your files in the directory.


Tip: If you have a folder with subfolders that holds these images. You could use this for loop to find all .TIF files within that folder:


for f in $(find -name *.tif); do ...; done

[#43575] Thursday, October 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
izecaptur

Total Points: 113
Total Questions: 102
Total Answers: 114

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
;