Resize .tif file and convert to .jpg
In the lab we have a photocopier that can scan too. Quite cool, you can precise your email address and it sends you the scanned page in .tif format.
However, pages must be scanned one by one and each of them is sent as a separate .tif file. Each .tif file is around 2.8 MB large with a resolution of 4900 x 7000 pixels. How to resize them and convert them to .jpg files? Gimp is one way but could we solve it in command-line?
Put the .tif files in a folder and create a subfolder called “out”. This way the output won’t be mixed with the input.
for i in *.tif; do echo $i; convert $i -resize 24% out/`basename $i .tif`.jpg; done
Each .tif is made smaller (width around 1200 pixels) and converted to .jpg.
As a final touch, convert the JPGs to a PDF file.
cd out convert *.jpg doc.pdf
Does anyone know how to to resize an image the following way: let width be 1200 pixels and keep the aspect ratio? Above the 24% was the result of a manual computation…
Answer: just use “
convert -resize 1200 in.tif out.jpg“. The output will have width=1200 pixels with the same ratio as the input image. (Thanks Yves for the tip.)