The following two commands give me the desired image:
convert foo-Alpha.jpg -alpha copy foo-Raw\ Shadow.jpg -alpha copy mask4.png
convert mask4.png foo.jpg -compose atop -composite final.png
However when I attempt to combine it into one single call using image stacking it does not work:
convert \( foo-Alpha.jpg -alpha copy foo-Raw\ Shadow.jpg -alpha copy) foo.jpg -compose atop -composite final.png
What am I doing wrong?
image stack and composite
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: image stack and composite
Unless you have some typos or I misundestand, you need toconvert \( foo-Alpha.jpg -alpha copy foo-Raw\ Shadow.jpg -alpha copy) foo.jpg -compose atop -composite final.png
1) remove the space between foo-Raw\ Shadow.jpg -- I presume foo-Raw is a directory and Shadow.jpg does not start with a space in the name. If it does, then put quotes around "foo-Raw\ Shadow.jpg"
2) add a space after -alpha copy and put an escape before the last paren
convert \( foo-Alpha.jpg -alpha copy foo-Raw\Shadow.jpg -alpha copy \) foo.jpg -compose atop -composite final.png
Re: image stack and composite
I wish it were that easy. The foo-Raw\ Shadow.jpg is indeed correct. There is a space in the filename. Just for grins I renamed the file w/o a space. I fixed the space before the last \) though. This still doesn't work:
convert \( foo-Alpha.jpg -alpha copy foo-RawShadow.jpg -alpha copy \) foo.jpg -compose atop -composite final.png
convert \( foo-Alpha.jpg -alpha copy foo-RawShadow.jpg -alpha copy \) foo.jpg -compose atop -composite final.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: image stack and composite
I do not understand this operation. It appears to be creating two images of the alpha channels from foo-Alpha.jpg and foo-RawShadow.jpg. Thus your total command line has 3 images to composite with atop. Unless the last image foo.jpg is a mask, I am not sure that works.foo-Alpha.jpg -alpha copy foo-RawShadow.jpg -alpha copy
Please clarify what you are trying to do and/or provide links to your images, so others can test.
Re: image stack and composite
Sorry for not explaining. I have 3 jpgs. 1 is a color .jpg with a shadow, another is an alpha (b&w) jpg, lastly is a shadow .jpg. The color .jpg has a background I want to remove, the alpha .jpg gives me the cutout shape I want and the shadow is the same shadow as the color image minus the color image itself.
The following commands give me the picture i want:
composite goo-Alpha.jpg -alpha copy goo-Raw\ Shadow.jpg -alpha copy goo-Mask.png
composite goo.jpg goo-Mask.png -compose atop goo4.png
I think there should be a way to combine all of this into one command but I can't seem to figure it out.
The following commands give me the picture i want:
composite goo-Alpha.jpg -alpha copy goo-Raw\ Shadow.jpg -alpha copy goo-Mask.png
composite goo.jpg goo-Mask.png -compose atop goo4.png
I think there should be a way to combine all of this into one command but I can't seem to figure it out.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: image stack and composite
try
convert \( "goo-Raw\ Shadow.jpg" -alpha copy \) \
\( goo-Alpha.jpg -alpha \) -compose over -composite \
goo.jpg -compose atop goo4.png
Note the quotes around the first image due to the space in the name.
if on windows, remove the \ from before ( and ) and change \ to ^ at the end of the lines. See http://www.imagemagick.org/Usage/windows/
If that does not work, please post links to your input and output images so we can test with them.
convert \( "goo-Raw\ Shadow.jpg" -alpha copy \) \
\( goo-Alpha.jpg -alpha \) -compose over -composite \
goo.jpg -compose atop goo4.png
Note the quotes around the first image due to the space in the name.
if on windows, remove the \ from before ( and ) and change \ to ^ at the end of the lines. See http://www.imagemagick.org/Usage/windows/
If that does not work, please post links to your input and output images so we can test with them.
Re: image stack and composite
Thanks so much. I took what you had wrote and came up with this to get exactly what I wanted:
convert \( "goo-Raw Shadow.jpg" -alpha copy \) \( goo-Alpha.jpg -alpha copy \) -compose over -composite goo.jpg -compose atop -composite goo5.png
convert \( "goo-Raw Shadow.jpg" -alpha copy \) \( goo-Alpha.jpg -alpha copy \) -compose over -composite goo.jpg -compose atop -composite goo5.png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: image stack and composite
Hmmm you make a alpha copy of the first image add a second then get an alpha copy of both.simont wrote:Code: Select all
convert \( foo-Alpha.jpg -alpha copy foo-RawShadow.jpg -alpha copy \) foo.jpg -compose atop -composite final.png
That first will become all white (no alpha to copy)! Then as fred said you have three images for the compose, the third being a 'masking' image for the composition (actually a negated write mask).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/