Difference between revisions of "Photo Frame"

From YobiWiki
Jump to navigation Jump to search
m
m
Line 16: Line 16:
   
 
#If you don't (want to) have ImageMagick, you can get w & h with this line:
 
#If you don't (want to) have ImageMagick, you can get w & h with this line:
#eval $(jpegtopnm $i 2>/dev/null |pnmfile|grep stdin|sed 's/^.* \([0-9]\+\) by \([0-9]\+\)
+
#eval $(jpegtopnm $i 2>/dev/null |pnmfile|grep stdin|sed 's/^.* \([0-9]\+\) by \([0-9]\+\) .*$/w=\1;h=\2/')
   
.*$/w=\1;h=\2/')
 
 
if [ $(($w*3)) -lt $(($h*4)) ]; then
 
if [ $(($w*3)) -lt $(($h*4)) ]; then
 
SCALE="-ysize=480"
 
SCALE="-ysize=480"

Revision as of 20:49, 28 November 2006

No need for 3456x2304 pictures if you want to see them on those small photo frames.
E.g. the Philips 7FF1AW is 720x480.
Resize your pictures and you'll be able to put much more of them in your frame.

Here is an example script, it requires identify from ImageMagick and tools from netpbm.
Run it at the root of the directory full of your big pictures, it will resize all of them (and delete the original pictures, be careful!!)
Here it is 640x480, change SCALE data if you need another size.

#!/bin/bash
for i in $(find $PWD -name "*.[Jj][Pp][Gg]"|grep -v "_s\."); do
echo "Convert $i"

#This requires ImageMagick to get the size of the image:
w=$(identify -format "%w" $i)
h=$(identify -format "%h" $i)

#If you don't (want to) have ImageMagick, you can get w & h with this line:
#eval $(jpegtopnm $i 2>/dev/null |pnmfile|grep stdin|sed 's/^.* \([0-9]\+\) by \([0-9]\+\) .*$/w=\1;h=\2/')

if [ $(($w*3)) -lt $(($h*4)) ]; then
    SCALE="-ysize=480"
else
    SCALE="-xsize=640"
fi
jpegtopnm $i |pnmscale $SCALE |pnmtojpeg --quality=95 > ${i/./_s.}
rm $i
done