Help needed on Framing script from examples.
Posted: 2012-08-31T11:34:02-07:00
I am testing the script from
http://www.imagemagick.org/Usage/thumbnails/#self_frame
When I run the script from the shell "bash eframe.sh" It will render the new image but not the frame.
Any help would be great.
Files
http://www.mediafire.com/?2nwtm98n4xdv0qm
I am using IM 6.6.9-7 on Unbuntu 12.04.
Here is the script, eframe.sh
image=tempnew.png
image_w=`convert $image -format %w info:`
image_h=`convert $image -format %h info:`
top="edge_images/goldthin_top.png"
btm="edge_images/goldthin_btm.png"
width=`convert $top -format %h info:`
length=`convert $top -format %w info:`
# Size of the new image ( using BASH integer maths)
new_size=$(($image_w+$width*2))x$(($image_h+$width*2))
# IM options to read a 'randomly rolled' version for the edge pieces
lft="( $top -roll +$(($RANDOM % $length))+0 -transpose )"
rht="( $btm -roll +$(($RANDOM % $length))+0 -transpose )"
# IM options to 'randomly rolled' the top and bottom pieces
top="( $top -roll +$(($RANDOM % $length))+0 )"
btm="( $btm -roll +$(($RANDOM % $length))+0 )"
# Frame the image in a single IM command....
convert -page +$width+$width $image +page -matte \
\( +clone -compose Dst -bordercolor none -frame ${width}x$width+$width \
-fill none -draw "matte 0,0 replace" \
-flip -draw "matte 0,0 replace" -flip \) \
\( $top $btm -append -background none -splice 0x${image_h}+0+$width \
-write mpr:horz +delete -size $new_size tile:mpr:horz +size \
-clone 1 -compose DstOut -composite \) \
\( $lft $rht +append -background none -splice ${image_w}x0+$width+0 \
-write mpr:vert +delete -size $new_size tile:mpr:vert +size \
-clone 1 -compose DstIn -composite \) \
-delete 1 -compose Over -mosaic framed_script.png
http://www.imagemagick.org/Usage/thumbnails/#self_frame
When I run the script from the shell "bash eframe.sh" It will render the new image but not the frame.
Any help would be great.
Files
http://www.mediafire.com/?2nwtm98n4xdv0qm
I am using IM 6.6.9-7 on Unbuntu 12.04.
Here is the script, eframe.sh
image=tempnew.png
image_w=`convert $image -format %w info:`
image_h=`convert $image -format %h info:`
top="edge_images/goldthin_top.png"
btm="edge_images/goldthin_btm.png"
width=`convert $top -format %h info:`
length=`convert $top -format %w info:`
# Size of the new image ( using BASH integer maths)
new_size=$(($image_w+$width*2))x$(($image_h+$width*2))
# IM options to read a 'randomly rolled' version for the edge pieces
lft="( $top -roll +$(($RANDOM % $length))+0 -transpose )"
rht="( $btm -roll +$(($RANDOM % $length))+0 -transpose )"
# IM options to 'randomly rolled' the top and bottom pieces
top="( $top -roll +$(($RANDOM % $length))+0 )"
btm="( $btm -roll +$(($RANDOM % $length))+0 )"
# Frame the image in a single IM command....
convert -page +$width+$width $image +page -matte \
\( +clone -compose Dst -bordercolor none -frame ${width}x$width+$width \
-fill none -draw "matte 0,0 replace" \
-flip -draw "matte 0,0 replace" -flip \) \
\( $top $btm -append -background none -splice 0x${image_h}+0+$width \
-write mpr:horz +delete -size $new_size tile:mpr:horz +size \
-clone 1 -compose DstOut -composite \) \
\( $lft $rht +append -background none -splice ${image_w}x0+$width+0 \
-write mpr:vert +delete -size $new_size tile:mpr:vert +size \
-clone 1 -compose DstIn -composite \) \
-delete 1 -compose Over -mosaic framed_script.png