Jump to content

Solution for resizing images to photo.net spec (linux users)


Recommended Posts

This is not a question. I found a solution, and thought I would share

it.<br>

<br>

Photo.net prefers photos to be sized with a largest dimension of 800

pixels, and file size to be 100KB.<br>

<br>

For you Linux users out there who use the Nautilus file browser, here

is a tip.<br>

<br>

When you right click on a photo, one of the options is "scripts".

These scripts are in ~/.gnome2/nautilus-scripts/<br>

<br>

Put the following in that directory, and name it photo.net.sh:

<br>

<pre>

--- cut photo.net.sh ---

#!/bin/bash

# script to scale an image such that its largest dimension is 800 pixels,

# and the modified image is stored in ./photo.net/

# a quality level of 85 seems to look decent and be near 100KB.

 

DIR=photo.net

QUALITY=85

 

if [ ! -d $DIR ]

then

mkdir $DIR

fi

 

cp $1 $DIR

mogrify -quality $QUALITY -resize 800x800\> $DIR/$1

--- cut ---

</pre>

<br>

this scales the image (using a Lanczos filter) to 800 pixels, and

preserves the aspect ratio, and puts the scaled copy into a

"photo.net" sub directory.<br>

<br>

Also, I put in "rotate_right.sh" and "rotate_left.sh" in the scripts

directory, so I can right click a thumbnail preview in nautilus and

rotate it.<br>

<br>

<pre>

--- cut rotate_right.sh ---

#!/bin/bash

# script to rotate a jpeg image 90 degrees clockwise,

# overwriting the old image at 100% quality.

 

mogrify -rotate 90 -quality 100 $1

--- cut ---

</pre>

<br>

just make two copies of that, and replace "90" with "270" for rotating

left.<br>

<br>

hope this reaches the right eyes. it sure made my life easier.

suggestions, etc, of course welcome.<br>

<br>

-jason pepas<br>

<br>

ps - don't forget to chmod +x them!<br>

<br>

Link to comment
Share on other sites

Thanks for the tip Michael.

 

The updated script following that suggestion would look like:

<pre>

--- cut rotate_right.sh ---

#!/bin/bash

# script to rotate a jpeg image 90 degrees clockwise,

# overwriting the old image, losslessly

 

jpegtran -rotate 90 -copy all -outfile "$1" "$1"

--- cut ---

</pre>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...