Page 1 of 1

mixing images

Posted: 2009-12-22T23:06:43-07:00
by manit
i have a fantastic idea.
Suppose I have two images one contains red colour only while other contains only yellow colour & I want that both images should be combined such that when they overlap at a point then resultant colour appears that is red+yellow=orange.
How can this be done ?
Will I have to take a pixel from each file then combine both colours.I hope there is an easy way ?

Re: mixing images

Posted: 2009-12-23T10:43:04-07:00
by fmw42

Draw line with red color over yellow then orange be outcome

Posted: 2009-12-29T03:11:14-07:00
by manit
I tried blend & dissolve but image intensity decreases if I want to mix two images equally.
My idea is to draw series of red coloured circled then draw yellow on same image so that at points of intersection I get orange . Is that possible ?

Re: Draw line with red color over yellow then orange be outcome

Posted: 2009-12-29T16:54:50-07:00
by fmw42
manit wrote:I tried blend & dissolve but image intensity decreases if I want to mix two images equally.
My idea is to draw series of red coloured circled then draw yellow on same image so that at points of intersection I get orange . Is that possible ?

Try -compose plus -composite, see http://www.imagemagick.org/Usage/compose/#plus

Re: mixing images

Posted: 2016-01-02T05:00:28-07:00
by manit
It has been a long long time .
But , better late than never .
Here are the results .

creating blue concentric circles of varying intensity

Code: Select all

cd "C:\Program Files\ImageMagick-6.9.2-Q16"
c:
imconvert -size 510x488 xc:none -fill "rgb(0,0,16)" -draw "circle 250,170 250,180" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,32)" -draw "circle 250,170 250,180" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,48)" -draw "circle 250,170 250,190" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,64)" -draw "circle 250,170 250,200" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,80)" -draw "circle 250,170 250,210" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,96)" -draw "circle 250,170 250,220" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,112)" -draw "circle 250,170 250,230" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,128)" -draw "circle 250,170 250,240" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,144)" -draw "circle 250,170 250,250" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,160)" -draw "circle 250,170 250,260" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,176)" -draw "circle 250,170 250,270" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,192)" -draw "circle 250,170 250,280" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,208)" -draw "circle 250,170 250,290" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,224)" -draw "circle 250,170 250,300" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,240)" -draw "circle 250,170 250,310" d:\im\compose_B.png
imconvert d:\im\compose_B.png -fill none -strokewidth 10 -stroke "rgb(0,0,255)" -draw "circle 250,170 250,320" d:\im\compose_B.png
creating green concentric circles of varying intensity

Code: Select all

cd "C:\Program Files\ImageMagick-6.9.2-Q16"
c:
imconvert -size 510x488 xc:none -fill "rgb(0,16,0)" -draw "circle 340,318 340,328" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,32,0)" -draw "circle 340,318 340,328" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,48,0)" -draw "circle 340,318 340,338" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,64,0)" -draw "circle 340,318 340,348" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,80,0)" -draw "circle 340,318 340,358" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,96,0)" -draw "circle 340,318 340,368" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,112,0)" -draw "circle 340,318 340,378" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,128,0)" -draw "circle 340,318 340,388" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,144,0)" -draw "circle 340,318 340,398" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,160,0)" -draw "circle 340,318 340,408" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,176,0)" -draw "circle 340,318 340,418" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,192,0)" -draw "circle 340,318 340,428" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,208,0)" -draw "circle 340,318 340,438" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,224,0)" -draw "circle 340,318 340,448" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,240,0)" -draw "circle 340,318 340,458" d:\im\compose_G.png
imconvert d:\im\compose_G.png -fill none -strokewidth 10 -stroke "rgb(0,255,0)" -draw "circle 340,318 340,468" d:\im\compose_G.png
creating red concentric circles of varying intensity

Code: Select all

cd "C:\Program Files\ImageMagick-6.9.2-Q16"
c:
imconvert -size 510x488 xc:none -fill "rgb(16,0,0)" -draw "circle 170,318 170,328" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(32,0,0)" -draw "circle 170,318 170,328" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(48,0,0)" -draw "circle 170,318 170,338" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(64,0,0)" -draw "circle 170,318 170,348" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(80,0,0)" -draw "circle 170,318 170,358" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(96,0,0)" -draw "circle 170,318 170,368" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(112,0,0)" -draw "circle 170,318 170,378" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(128,0,0)" -draw "circle 170,318 170,388" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(144,0,0)" -draw "circle 170,318 170,398" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(160,0,0)" -draw "circle 170,318 170,408" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(176,0,0)" -draw "circle 170,318 170,418" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(192,0,0)" -draw "circle 170,318 170,428" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(208,0,0)" -draw "circle 170,318 170,438" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(224,0,0)" -draw "circle 170,318 170,448" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(240,0,0)" -draw "circle 170,318 170,458" d:\im\compose_R.png
imconvert d:\im\compose_R.png -fill none -strokewidth 10 -stroke "rgb(255,0,0)" -draw "circle 170,318 170,468" d:\im\compose_R.png
I combined above 3 files

The result was not so flattering as colours mixed were not of equal intensity .
I was hoping of an image in which red colour of level 16 will mix with green and blue of 16 .
Actually , i will need a gradient for that .

Re: mixing images

Posted: 2016-01-02T10:29:00-07:00
by snibgo
manit wrote:I tried blend & dissolve but image intensity decreases if I want to mix two images equally.
A very late response to that particular point: when blending graphic colours, the result often looks better if you convert to linear RGB before blending, then back to sRGB after blending.

Or, of course, do all the work in linear RGB, and convert only the final result to sRGB.

Re: mixing images

Posted: 2016-01-02T11:07:03-07:00
by fmw42
manit wrote:i have a fantastic idea.
Suppose I have two images one contains red colour only while other contains only yellow colour & I want that both images should be combined such that when they overlap at a point then resultant colour appears that is red+yellow=orange.
How can this be done ?
Will I have to take a pixel from each file then combine both colours.I hope there is an easy way ?

Not sure if this is what you want, but try this (unix syntax)

Code: Select all

convert -size 128x128 xc:"rgba(255,0,0,0.5)" \
-page +64+64 -size 128x128 xc:"rgba(255,255,0,0.5)" \
-background none -layers merge +repage -alpha off orange.png
Windows syntax:

Code: Select all

convert.exe -size 128x128 xc:"rgba(255,0,0,0.5)" ^
-page +64+64 -size 128x128 xc:"rgba(255,255,0,0.5)" ^
-background none -layers merge +repage -alpha off orange.png