Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > Miscellaneous topics > Imagemagick for...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1403 of 1475
Post > Topic >>

Imagemagick for digital foto frame 480x234

by OpaPiloot <me@[EMAIL PROTECTED] > Nov 12, 2007 at 04:37 PM

The popular 480x234 digital foto frame has an odd aspect ratio.
Its resolution is not as specified 480/234, but after trying to count
the pixels
I think it's 416x234, which corresponds to an aspect ratio of 16:9 i.e.
1.7778
However, I noticed that 832x468 pictures are displayed notably sharper
than 416x234.
When preparing pictures with my favorite photo editor, I crop all foto's
in landscape format,
not wider than 16:9.
Normally, narrower pictures will have black borders at both sides when
displayed.
I wanted these borders in a color that is the average of the picture.
I use Imagemagick convert to shrink the picture to 1x1 and then use the
color of this pixel.
This appears to work wonderfully.
Then I use Imagemagick montage to make 832x468 pictures with optional
side borders.

The following script runs on my windows XP system, with the MKS (Unix
lookalike) toolset and Imagemagick installed.
It should also run with Cygwin and under Linux or other Unix lookalikes.
Besides convert and montage, sh, od and awk are used.
Maybe there is a more elegant way to obtain the average color, but I
don't know it.

####################################################################
#!sh
# current directory contains source JPG files
# $DES is where the prepared JPG files are stored
# $TMP is a tem****ary directory
GEO=832x468 # geometry of target JPG files and resize value
#
for F in *.jpg
do
convert -resize 1x1 "$F" "$TMP/1x1.bmp"
od -A n -j 54 -t u1 "$TMP/1x1.bmp" | awk -v f="$F" -v des="$DES/" -v
geo="$GEO" '
{
 print "montage -geometry", geo, "-resize", geo, "-background rgb\\(" $3
"," $2 "," $1 "\\) \"" f "\" \"" des f "\"";
 exit;
}'
done | sh -x
####################################################################

--
Have fun, Bert
 




 1 Posts in Topic:
Imagemagick for digital foto frame 480x234
OpaPiloot <me@[EMAIL P  2007-11-12 16:37:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Nov 23 12:47:53 CST 2008.