[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gallery-users
Subject:    Re: [Gallery-users] Using NetPbm outside of gallery
From:       Markus Illenseer <markus () core ! de>
Date:       2002-06-28 4:55:43
[Download RAW message or body]

> # ls
> README          pngtopnm        pnmflip
> pnmtopng        ppmtojpeg
> giftopnm        pnmcut          pnmrotate
> ppmquant
> jpegtopnm       pnmfile         pnmscale
> ppmtogif
>
> Which would I use to resize jpg files into thumbs?

 Before we start, please read the basic manual page (or web site) of
netpbm about what it does, what it offers and how it works. "man ppm" is
the first page.

 Assume your image is called "test.jpg", size of it is 1024x768. You want
a thumnail of 100x100 at max, but leave the aspect ratio.

 # jpegtopnm test.jpg > test.pnm

 This extract the JPEG to the (non-lossy) PNM format

 # pnmscale -xysize 100 100 test.pnm > test_thumb.pnm

 -xysize specifies a bounding box.  pnmscale scales the input image to the
largest size that fits within the box, while preserving its aspect ratio.

 # pnmtojpeg --quality 75 test_thumb.pnm > test_thumb.jpg

 Converts the pnm to a jpeg, using the jpeg lossy quality of 75%.

 Now you need a shell wrapper for the three lines, which finds all your
images and converts them... Your homework ;-)


 The conversion from and to jpeg is always lossy. If you would do this:

 # jpegtopnm test.jpg > test.pnm
 # pnmtojpeg --quality 95 test.pnm > test_new.jpg

 the new image is not a single bit identical.

Markus Illenseer



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Caffeinated soap. No kidding.
http://thinkgeek.com/sf
 
 
__[ g a l l e r y - u s e r s ]_________________________

[ list archive/(un)subscribe --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]
[ gallery good karma --> http://gallery.sf.net/donate.php?dt=gu ]
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic