Page 1 of 1
image stack and composite
Posted: 2012-08-02T21:59:22-07:00
by simont
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?
Re: image stack and composite
Posted: 2012-08-02T22:10:58-07:00
by fmw42
convert \( foo-Alpha.jpg -alpha copy foo-Raw\ Shadow.jpg -alpha copy) foo.jpg -compose atop -composite final.png
Unless you have some typos or I misundestand, you need to
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
Posted: 2012-08-02T23:22:18-07:00
by simont
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
Re: image stack and composite
Posted: 2012-08-03T09:43:45-07:00
by fmw42
foo-Alpha.jpg -alpha copy foo-RawShadow.jpg -alpha copy
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.
Please clarify what you are trying to do and/or provide links to your images, so others can test.
Re: image stack and composite
Posted: 2012-08-03T22:11:39-07:00
by simont
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.
Re: image stack and composite
Posted: 2012-08-04T10:03:05-07:00
by fmw42
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.
Re: image stack and composite
Posted: 2012-08-07T22:49:27-07:00
by simont
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
Re: image stack and composite
Posted: 2012-08-08T18:49:22-07:00
by anthony
simont wrote:Code: Select all
convert \( foo-Alpha.jpg -alpha copy foo-RawShadow.jpg -alpha copy \) foo.jpg -compose atop -composite final.png
Hmmm you make a alpha copy of the first image add a second then get an alpha copy of both.
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).