Skip to Content.
Sympa Menu

baslinux - Re: [BL] script to shrink photos

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: David Moberg <davidjmoberg AT gmail.com>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] script to shrink photos
  • Date: Mon, 26 Dec 2005 21:39:32 -0800

On 12/26/05, sindi keesan <keesan AT sdf.lonestar.org> wrote:
> Rather than upload megabytes of 200K 1280 res photos, I am using netpbm
> programs to cut the size to 50K. pamscale reduces X and Y by the same
> factor as a default (.5 in my case).
> I called my script halve.
>
> jpegtopnm $1 > temp1.pnm
> pamscale .5 temp1.pnm > temp2.pnm (or big.pnm and small.pnm if you prefer)

Are you sure that it is pamscale? I do not have pamscale here, (not
sure what version of netpbm I have) but I do have pnmscale, which
appears to work with this script.

> I have tried various changes to my script and they all produce 0 length
> files. I don't think I can output > $1 to end up with the same name file
> I started with.
>
> How can I at least avoid the step of renaming temp.jpg, and if possible,
> how can I shrink all the files in a directory with one command or script?
>
> For i in .... ?

jpegtopnm infile.jpg | pnmscale .5 | pnmtojpeg >outfile.jpg

You need to put this in a 'for' loop in order to process multiple files
at once.

> No I don't want to use gimp

The gimp is a very poor choice for simple batch processing like this.
netpbm is faster, smaller, easier to set up, and therefore much more
efficient at this particular task.

gimp is mainly useful for complex touch-up work such as
"photoshopping".

> Pamscale is taking 5-10 seconds per photo and uses 99.8% of cpu but very
> little memory to scale down (reduce). It must be averaging out the colors
> of two pixels to make one.

> Don't try this on a 486. Rotating images takes more memory and crashes a
> 486 with 24MB RAM and no swap file.

Does it use less memory if you use a smaller image?

David




Archive powered by MHonArc 2.6.24.

Top of Page