Hi,
the following images greenbox.jpg and bluebox.jpg are two boxes of different dimension. I want the greenbox to cover the bluebox. I find the -dissolve,
from http://www.imagemagick.org/Usage/compose/#blend and I want to achieve the similar result as the dissolve 100% effect which is the greenbox cover part of the bluebox. However, when I do the following, the blue box are complete gone. Any help is appreciated.
convert -size 640x640 xc:black -fill green -draw "rectangle 0, 128, 639,256" greenbox.jpg
convert -size 640x640 xc:black -fill blue -draw "rectangle 64,64,576,576" bluebox.jpg
composite -dissolve 100% greenbox.jpg bluebox.jpg gif:-|display -
the usage of -dissolve
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: the usage of -dissolve
a dissolve of 100% will make one image completely cover the other. You need to specify two dissolve values or one value that is not 0 or 100%. see http://www.imagemagick.org/Usage/compose/#dissolve. Or make the background transparent and not black.composite -dissolve 100% greenbox.jpg bluebox.jpg gif:-|display -
try
composite -dissolve 50% greenbox.jpg bluebox.jpg show:
Re: the usage of -dissolve
In the given link http://www.imagemagick.org/Usage/compose/#dissolve, the dissolve 100% example show two pictures which is what I want.
How can I make the background transient?
How can I make the background transient?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: the usage of -dissolve
try using xc:none in your code above for your green image, so that the background is transparent like Anthony's example.
Or make the first image smaller in both dimensions than the other.
Or make the first image smaller in both dimensions than the other.
Re: the usage of -dissolve
xc:none cannot make the background transparent. This is what I tried.
convert -size 640x640 xc:none -fill green -draw "rectangle 0, 128, 639,256" greenbox.jpg
convert -size 640x640 xc:black -fill blue -draw "rectangle 64,64,576,576" bluebox.jpg
composite -dissolve 100% greenbox.jpg bluebox.jpg gif:-|display -
convert -size 640x640 xc:none -fill green -draw "rectangle 0, 128, 639,256" greenbox.jpg
convert -size 640x640 xc:black -fill blue -draw "rectangle 64,64,576,576" bluebox.jpg
composite -dissolve 100% greenbox.jpg bluebox.jpg gif:-|display -
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: the usage of -dissolve
JPG does NOT support transparency. Change your greenbox (and bluebox) to png. That way you don't have quality loss from jpg.vita001 wrote:xc:none cannot make the background transparent. This is what I tried.
convert -size 640x640 xc:none -fill green -draw "rectangle 0, 128, 639,256" greenbox.jpg
convert -size 640x640 xc:black -fill blue -draw "rectangle 64,64,576,576" bluebox.jpg
composite -dissolve 100% greenbox.jpg bluebox.jpg gif:-|display -
convert -size 640x640 xc:none -fill green -draw "rectangle 0, 128, 639,256" greenbox.png
convert -size 640x640 xc:black -fill blue -draw "rectangle 64,64,576,576" bluebox.png
composite -dissolve 100% greenbox.png bluebox.png show:
Re: the usage of -dissolve
If I have a png file(which is obtained by converting a jpg files), I want to change the black background color to transparent. So I do the following:
convert test.png -fill xc:none -opaque black -fuzz 20% test.png
However, it seems not working, if I do the following
composite -dissolve 100% test.png test2.png gif:-|display -
test.png still completely covers test2.png.
Any solutions? Thanks.
convert test.png -fill xc:none -opaque black -fuzz 20% test.png
However, it seems not working, if I do the following
composite -dissolve 100% test.png test2.png gif:-|display -
test.png still completely covers test2.png.
Any solutions? Thanks.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: the usage of -dissolve
Your -fill xc:none is an invalid command.If I have a png file(which is obtained by converting a jpg files), I want to change the black background color to transparent. So I do the following:
convert test.png -fill xc:none -opaque black -fuzz 20% test.png
To change black to transparent use either
convert test.png -fuzz 20% -fill none -opaque black test.png[/quote]
or better
convert test.png -fuzz XX% -transparent black result.png
Note that -fuzz must come before -transparent or -fill.
Re: the usage of -dissolve
This one doesn't work :convert test.png -fuzz 20% -fill none -opaque black test.png
But this one does: convert test.png -fuzz XX% -transparent black result.png
Thank you very much. I finally have what I want.
But this one does: convert test.png -fuzz XX% -transparent black result.png
Thank you very much. I finally have what I want.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: the usage of -dissolve
vita001 wrote:This one doesn't work :convert test.png -fuzz 20% -fill none -opaque black test.png
But this one does: convert test.png -fuzz XX% -transparent black result.png
Thank you very much. I finally have what I want.
The first one should be working as I thought it had been fixed. You can make it work by
convert test.png -channel rgba -fill none -opaque white result.png