Interesting Problem...Overlap only the transparent portions
Posted: 2011-01-28T07:10:08-07:00
I'm trying to overlay two images, top to bottom, but with some overlap of the transparent areas.
Image #1: convert -background none -fill red -font Arial -pointsize 72 label:Jimmy\'s one.png
Image #2: convert -background none -fill blue -font Courier -pointsize 72 label:Place two.png
I found some help that showed me how to concatenate the two images top to bottom, as close as possible without overlapping:
Initial Result: convert -background none -append -alpha set -bordercolor none -trim -layers trim-bounds one.png two.png three.png
However, what I'm trying to do is to get those two lines of text much closer together. With the command above, the 'y' in 'Jimmy's' sets the bottom border of the first image, and puts too much space between the two lines of text. I'm trying to get something like this "hand created" image:
Is there anything in ImageMagick that could overlay two images, top to bottom, and overlap the transparent areas without allowing any colored pixels to overlap? Would be stellar if I could specify some number of pixels as a "border"... ( i.e, keep colored pixels in image #1 at least X pixels away from colored pixels in image #2 ).
Note: In the production code, these images are generated on the fly from user generated text, fonts, etc, so I can't just overlap the images manually using some pixel offset.
FYI, thanks so much to everyone that works on IM. It's a wonderful and powerful tool!
Image #1: convert -background none -fill red -font Arial -pointsize 72 label:Jimmy\'s one.png
Image #2: convert -background none -fill blue -font Courier -pointsize 72 label:Place two.png
I found some help that showed me how to concatenate the two images top to bottom, as close as possible without overlapping:
Initial Result: convert -background none -append -alpha set -bordercolor none -trim -layers trim-bounds one.png two.png three.png
However, what I'm trying to do is to get those two lines of text much closer together. With the command above, the 'y' in 'Jimmy's' sets the bottom border of the first image, and puts too much space between the two lines of text. I'm trying to get something like this "hand created" image:
Is there anything in ImageMagick that could overlay two images, top to bottom, and overlap the transparent areas without allowing any colored pixels to overlap? Would be stellar if I could specify some number of pixels as a "border"... ( i.e, keep colored pixels in image #1 at least X pixels away from colored pixels in image #2 ).
Note: In the production code, these images are generated on the fly from user generated text, fonts, etc, so I can't just overlap the images manually using some pixel offset.
FYI, thanks so much to everyone that works on IM. It's a wonderful and powerful tool!