Announcement

#1 2009-12-19 16:43:04

jdd
Member
Toulouse (France)
2009-12-19
111

bash script to create images, thumbnails and folders

I find easier to have batch scripts to make my prepraration work. these are linux bash scripts, probably easy to translate in other languages.

First script (piwi.sh) go in the high definition (original) images, or better make first a copy... the script copies the files in the pwg_high directory and create images fitting in a 800x800 square for main view and thumbnails fitting in 128x128 (this accomodate rectangular images, portrait or landscape).

Warning: the scripts do no control, so they may fail if the directory hold invalid files (not jpg) or empty directories (no jpg). Don't run them twice as this will overwrite high def images! Convert is an imagemagic element.

#!/bin/sh                                                                         
# usage: se placer dans le répertoire de la galerie (avec les fichiers HD)         
#lancer "sh piwi.sh"                                                               
#On se retrouve avec les bons fichiers dans le bon répertoire                     
#il n'y a plus qu'à copier ca vers la galerie piwi

mkdir thumbnail
mkdir pwg_high

for I in *.jpg ; do
        echo $I
        mv $I pwg_high/
        convert -resize 800x800 pwg_high/$I $I ;
        convert -resize 128x128 $I thumbnail/TN-$I ;
done

If, like me, you have une folder for each day shots and a year parent folder, you can go in the parent folder and work the hole year with this:

#!/bin/sh
for j in */ ;  do
echo $j
cd $j
sh piwi.sh
cd ..
done

Offline

 

#2 2009-12-19 20:39:04

samli
Translation Team
Hungary (Budapest)
1970-01-01
65

Re: bash script to create images, thumbnails and folders

jdd wrote:

I find easier to have batch scripts to make my prepraration work. these are linux bash scripts, probably easy to translate in other languages.

First script (piwi.sh) go in the high definition (original) images, or better make first a copy... the script copies the files in the pwg_high directory and create images fitting in a 800x800 square for main view and thumbnails fitting in 128x128 (this accomodate rectangular images, portrait or landscape).

Hi,
Phatch Photo Batch Processor ?


Ubuntu 10.04 (Lucid Lynx)
XUbuntu 12.04 (Precise Pangolin)

Offline

 

#3 2009-12-19 21:08:40

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
6777

Re: bash script to create images, thumbnails and folders

Thank you for the link


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact