Re: GIMP can not do it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



elk dolk wrote:
Hi all,

I have some 600x450 pixel photos and want to reduce their size to 60K and keep the aspect ratio, GIMP can't do it , anyone know of a Linux photo manipulation SW for batch processing photos?

You are mixing units, 600x450 is pixels, and I assume you want 60k as a file size.

cd dir_with_images
mkdir SMALL
ls *.jpg |
while read file; do
  djpeg "${file}" | pnmscale -xys 400 300 |
  cjpeg -Q 60 -o -smo 20 -dct float >SMALL/"${file}"
done

Notes:
1 - the quotes are needed if you have special characters in the filenames
2 - -Q is quality, higher is larger, adjust to tune
3 - "-xys 400 300" scales to 400x300, you can also use a single f.p. number like 0.7 to scale to fractional sizes. You may not need to scale at all, that step is optional if the cjpeg makes things small enough.
4 - "-o" is optimize, create smaller image, keep that option
5 - "-smo xx" is smoothing, if you use too much the images will be smaller but look like garbage.
6 - don't use xargs, handling special characters in filenames is ugly
7 - don't simplify to "while file in *.jpg" because it fails if you have too many files, and bash gives you "line too long" errors

As you may have guessed I have done rather a lot of these, this script should be bulletproof. Install netpbm if you don't have it.

--
Bill Davidsen <davidsen@xxxxxxx>
  "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux