Page 1 of 1

IMAGE OVERLAPING AND COLORING

Posted: 2012-08-16T01:12:53-07:00
by foruforewer
HI

I have two images and desired output which are as below. For same i have written below code. But i am not able to
1) Get black ground behind fonts.
2) Change image color
3) Common overlapped area changes color, while i want simply overlapped.

Can anyone guide?

Code: Select all

set in_path=C:\
set ou_path=C:\
set suffix=T.png

convert %in_path%%~1%suffix% -level 100%,0 im1.png
convert %in_path%%~2%suffix% -level 100%,0 im2.png

convert im1.png +level-colors red, +repage im1.png
convert im2.png +level-colors navy, +repage im2.png

composite -compose Multiply -gravity center im1.png im2.png %ou_path%%~3
convert %ou_path%%~3 -gravity north -splice 0X10 -gravity east -splice 10x0 -gravity west -splice 10x0 -gravity south -splice 0X60 -background black -pointsize 30 -font Arial-Bold -fill red -annotate -140+3 %~1 -fill navy -annotate +140+3 %~2 %ou_path%%~3

del im1.png
del im2.png

Source Image #1
Image

Source Image #2
Image

Desired Output#3
Image

Re: IMAGE OVERLAPING AND COLORING

Posted: 2012-08-16T10:40:03-07:00
by fmw42
colorize the black lines as desired. make the white background transparent, then just use -background black -flatten for the two images. give that a try and see what happens.

Re: IMAGE OVERLAPING AND COLORING

Posted: 2012-08-22T18:52:50-07:00
by anthony
The specific commands to use to make color overlays of the shapes is
-negate -backgound {color} -alpha shape

See Alpha Shape
http://www.imagemagick.org/Usage/masking/#alpha_shape

This ensures that white parts are made transparent, but the edges have there anti-aliasing pixel shades preserved.

You would then 'flatten' all the colored image shapes on a black (or other) background, a technique known as 'layering'
http://www.imagemagick.org/Usage/layers/#layers