Sorry, it appears that I did not notice the distortion. There is a limit of a factor of 2 expansion on liquid-rescale. After than it reverts to normal scaling.

_______________________________________




Here is a third and even easier method using the minimum size frame generated below and -liquid-rescale . However, it seems that liquid-rescale is not honoring the alpha channel (unless I have made a typo or there is something odd about the transparent area), so I had to make the transparent area white.

# change transparent to white
convert -size 120x176 xc:white fancy_add_frame1.gif -composite fancy_add_frame3.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add_frame3.gif

(Note: for some reason that I don't see this is not working:
convert fancy_add_frame1.gif -fill white -opaque none fancy_add_frame3.gif
so I had to use the composite method above)


# liquid-rescale in y only
convert fancy_add_frame3.gif -liquid-rescale 120x300! fancy_add_frame4a.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add_frame4a.gif


# liquid-rescale in x only
convert fancy_add_frame4a.gif -liquid-rescale 150x300! fancy_add_frame4b.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add_frame4b.gif


# make white back to transparent
convert fancy_add_frame4b.gif -transparent white fancy_add_frame4c.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add_frame4c.gif



Note that there may be an issue with how much expansion you can do in one step with -liquid-rescale



___________________________________




Here is an even easier way to extend the edges of the Northwest corner:

# crop and make transparent
convert fancy_add.jpg[60x88+2+2] -fuzz 20% -transparent "rgb(255,255,255)" +repage fancy_add2.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add2.gif


# flop to get Northwest corner
convert fancy_add2.gif -flop fancy_add4.gif

# extend Northwest corner to 100x150 (quarter size)
convert -size 100x150 xc:"#ffffffff" -channel RGBA fancy_add4.gif -fx "v" fancy_add5.gif

Then do something similar to the last step below to montage rearranged quadrants.

______________________________________




I have taken your fancy add.jpg cropped it to get rid of excess surrounding and such, then flipped it to get the southwest corner, made the white into transparent, extended the edges to fill out one quarter of the frame, then rearranged the quadrant to get the others and merged them so that it fills 200x300.


Here are my steps:

# crop and make transparent
convert fancy_add.jpg[60x88+2+2] -fuzz 20% -transparent "rgb(255,255,255)" +repage fancy_add2.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add2.gif


# test montage of minimum size frame
montage   \( fancy_add2.gif       -flop \) \
          \( fancy_add2.gif             \) \
          \( fancy_add2.gif -flip -flop \) \
          \( fancy_add2.gif -flip       \) \
          -tile x2 -geometry 60x88+0+0 -background none fancy_add_frame1.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add_frame1.gif


# flip to get southwest corner and extend sides to fill out one quarter of desired size frame
convert \( fancy_add2.gif -flip \) \
\( +clone -crop 1x88+1+0 +repage -scale 40x88! \) +swap +append +repage \ \( +clone -crop 100x1+0+1 +repage -scale 100x62! \) +swap -append +repage \
        fancy_add3.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add3.gif


# flip, flop and rotate 180 (flip and flop) and montage together with no space
montage \( fancy_add3.gif -flip -flop \) \( fancy_add3.gif -flip \) \
        \( fancy_add3.gif -flop \) fancy_add3.gif \
        -geometry +0+0 -tile x2 -background none fancy_add_frame2.gif
http://www.fmwconcepts.com/misc_tests/Framing/fancy_add_frame2.gif


With a little work, you can parameterize the sizes in step 3 above so that you can make the frame any size you want.

With a little more work you can probably get this down to one step for the last two above (or perhaps even for steps 1, 3 and 4).




All I have is a non-transparent corner piece of a real picture frame and I
want to use it wrap around an image.

Frame image that I want to wrap:

http://beta.posters2prints.com/scripts/fancy_add.jpg

Image that I want to wrap:

http://beta.posters2prints.com/scripts/thumbnail.jpg
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to