2006-08-02 Preparing Pictures

How to prepare pictures for uploading?

Here’s what I do: From the software I use to view the pictures, I export them while scaling them. These days I use 500 × 375 when exporting. I also give them meaningful names, and encode the date in the filename.

Then I remove all metadata from the images. This saves quite a bit of space, since the thumbnail in particular can be quite large.

img-strip *-30.jpg

Where *img-strip* calls *jpegtran* as follows:

#! /bin/sh
if [ -z $1 ]; then
    echo No images to cleanse.
    exit 1;
fi

for f in "$@"; do
    echo cleanse $f
    n=/tmp/`basename $f`
    jpegtran -optimize -trim -copy none -outfile "$n" "$f" && mv "$n" "$f"
done

Then I upload the files to my webspace.

upload *-30.jpg

The *upload* script calls *scp* as follows:

#! /bin/sh
if [ -z "$1" ]; then
    echo No images to upload.
    exit 1;
fi
chmod o+r "$@"
scp -p -C "$@" aschroeder@thinkmo.de:/org/org.emacswiki/htdocs/alex/pics/

And finally, I generate the necessary Oddmuse wiki markup to save me some typing:

ls -1t *-30.jpg|sed 's/\(.*\)/[[image external:\1|]]/'

Example output:

[[image external:gletscherschlucht-2006-07-30.jpg|]]
[[image external:grindelwald-2006-07-30.jpg|]]
[[image external:grosse-scheidegg-2006-07-30.jpg|]]
[[image external:oberer-gletscher-2006-07-30.jpg|]]
[[image external:reichenbachfall-2006-07-30.jpg|]]
[[image external:rosenlaui-2006-07-30.jpg|]]
[[image external:schlechtes-wetter-2006-07-30.jpg|]]
[[image external:stampede-2006-07-30.jpg|]]
[[image external:wellhorn-2006-07-30.jpg|]]
[[image external:wetterhorn-2006-07-30.jpg|]]

​#Pictures

Comments

(Please contact me if you want to remove your comment.)

Woudn’t it be neater to have it all in a simple .cgi script? You’d only upload a .tar or .zip with all the images (with meaningful names) and the rest is just automatic?

Personally, I just use an image board software to upload pictures and generate thumbnails.

– TheSheep 2006-08-02 17:11 UTC

TheSheep

---

Well, I like to interleave pictures and text, therefore a simple gallery is not enough for me. That means, I could combine the three steps I’m currently doing into one step, but I don’t feel like automating more of it.

If I were to automate more of it, I think I’d start using Flickr...

Flickr

– Alex Schroeder 2006-08-02 17:27 UTC

Alex Schroeder

---

I reduce my pictures using the following:

convert image1.jpeg -resize 50% -quality 75 image1-new.jpg

That typically reduces a 2M image to 160K, with hardly any noticeable difference. One can experiment with different resize/quality values.

– deusmax 2007-11-09 23:19 UTC

---

Wow... A comment on such an old post!

These days I find that I am in fact using Flickr to host my images. No more uploading to my personal webspace. My blog pages then just link to a single image and people interested in the pictures can follow the link to the Flickr gallery.

Example: Japan 2007.

Japan 2007

– Alex Schroeder 2007-11-09 23:26 UTC

Alex Schroeder