Batch jpeg image resize in linux
The (jpeg) photos we take using digital camera are just too large so to save space and bandwidth, it's better to resize them before uploading them to online photo sharing sites like Picasa or Flickr. Here's how i do it in linux..
Basically two commands are used here.
1. djpeg - decompress a JPEG file to an image file
2. cjpeg - compress an image file to a JPEG file
So to resize, i run this script on a folder containing the image files.
#!/bin/sh
mkdir resized
for i in *.JPG
do
echo 'Resizing image..' $i
djpeg -scale 1/2 $i | cjpeg > resized/$i
done
After script is done, a folder named 'resized' is created containing the resized images..
EDIT:
Both the program djpeg/cjpeg isn't installed by default, they're part of libjpeg-progs package. Under Ubuntu you can get it by
sudo apt-get install libjpeg-progs
(thanx subir dai for pointing this out)
Recap 2024: Public Speaking, blogging, interviews, tech community work and
other things
-
I started writing the year-in-review (recap) posts from 2019, so this will
be the sixth consecutive year I will write a yearly recap. Taking some time
to...
4 days ago
thanks for the info. was helpful for me.
ReplyDeletekeep it up with more tips and tricks
Okay nice blog you have got.
ReplyDeleteI suggest you to change the template. Find one to which you can add second side bar. I hope you can edit the css to do that. (I cannot do! :P)
http://keshuvko.blogspot.com
all the best
Hey jwalanta, that was really helpful! But it would've been better if u'd mentioned about the package that installs cjpeg and djpeg. They are part of the package 'libjpeg-progs' :) for others information.
ReplyDeletei cannot but do like you said... sorry...
ReplyDeleteMr Editor
you want to need Background Remover App? so install app and remove the background of photos.
ReplyDeleteI am thinking that in this time you should give a try to this new app Car Crash Simulator Royale Mod Apk : which is now most trending app in the world.
ReplyDelete