Compose image yields odd results
Compose image yields odd results
Very new to IM, so I'm sorry if this has an obvious answer.
I'm on a shared server with IM version 6.2.6. I'm trying to compose two images together using the command line.
This command (composite image.jpg shirt.jpg result.jpg) seems to reproduce image.jpg and shirt.jpg and call them result-0.jpg and result-1.jpg.
I tried using the convert command. This command (convert shirt.jpg image.jpg -composite result.jpg) produces result.jpg that looks like shirt.jpg with a black square the size of image.jpg on top of it. Something like this ...
I really have no idea what to try next. Any suggestions for me?
I'm on a shared server with IM version 6.2.6. I'm trying to compose two images together using the command line.
This command (composite image.jpg shirt.jpg result.jpg) seems to reproduce image.jpg and shirt.jpg and call them result-0.jpg and result-1.jpg.
I tried using the convert command. This command (convert shirt.jpg image.jpg -composite result.jpg) produces result.jpg that looks like shirt.jpg with a black square the size of image.jpg on top of it. Something like this ...
I really have no idea what to try next. Any suggestions for me?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Compose image yields odd results
See IM Examples. It has lots to try next.
In your case look in the Alpha Composition section.
http://www.imagemagick.org/Usage/compose/
In your case look in the Alpha Composition section.
http://www.imagemagick.org/Usage/compose/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Compose image yields odd results
Thank you for the suggestion, but I have read through that documentation many times and nothing I have tried has been any better.
I'm trying to keep the commands simple initially to eliminate variables. Then when I get it working I'll add in things like size and positioning. As it is, it seems to me like either of those simple commands ('composite image.jpg shirt.jpg result.jpg' OR 'composite image.jpg shirt.jpg result.jpg') should take these images:
and turn them into something more like this:
Am I wrong in that assumption?
I'm trying to keep the commands simple initially to eliminate variables. Then when I get it working I'll add in things like size and positioning. As it is, it seems to me like either of those simple commands ('composite image.jpg shirt.jpg result.jpg' OR 'composite image.jpg shirt.jpg result.jpg') should take these images:
and turn them into something more like this:
Am I wrong in that assumption?
Re: Compose image yields odd results
How about adding some links to your images ?
I would use convert shirt.jpg image.jpg -composite result.jpg
I would use convert shirt.jpg image.jpg -composite result.jpg
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Compose image yields odd results
After some trial and error, I found that with black and white images this convert command appears to do what you want:
[EDIT]: If you want the image to look like your example use SrcOver instead of multiply.
Pete
Code: Select all
convert shirt.jpg image.jpg -compose multiply -composite result.jpg
Pete
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Compose image yields odd results
losttime your command from what I can see should work. All I can think of is something is wrong with your input images.
Bonzo your example is exactly the same as the composite form, and should yeald the same result, bad if imputs are bad. The advantage of convert is that you can do other things before and after the composition.
and finally..
el_supremo Your command will do the job and will probably do what losttime really wants, (it adds black, never white to an image), but that is not dealing with the original problem.
losttime please post some links to the problem images so we can play with them and verify your problem and figure out the cause or the fix.
Lastly, applogies to everyone if I seem a little testy.
Bonzo your example is exactly the same as the composite form, and should yeald the same result, bad if imputs are bad. The advantage of convert is that you can do other things before and after the composition.
and finally..
el_supremo Your command will do the job and will probably do what losttime really wants, (it adds black, never white to an image), but that is not dealing with the original problem.
losttime please post some links to the problem images so we can play with them and verify your problem and figure out the cause or the fix.
Lastly, applogies to everyone if I seem a little testy.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Compose image yields odd results
Thank you for your input everyone.
Yes, what I'd really like to accomplish is what would be acheived by '-compose multiply', but since that wasn't working for me I thought I'd just try these simple commands for now.
Hmm ... in gathering the image links for you I discovered that my base image ('shirt.jpg') has some sort of error that prevents it from being displayed in the web browser. I've been noticing lately that Photoshop images saved as jpgs seem to have errors unless you specifically use the "Save for Web" feature. I won't be able to get an error-free file until Monday, but I imagine that could fix my problem. Until then, here are the image links anyway:
The shirt: http://www.graphichabit.com/redesign/im ... /tee_l.jpg
The design: http://www.graphichabit.com/redesign/im ... dina01.jpg
The results: http://www.graphichabit.com/redesign/im ... l/test.jpg (when using convert -compose);
http://www.graphichabit.com/redesign/im ... test-0.jpg (when using compose [A]);
http://www.graphichabit.com/redesign/im ... test-1.jpg (when using compose ).
Yes, what I'd really like to accomplish is what would be acheived by '-compose multiply', but since that wasn't working for me I thought I'd just try these simple commands for now.
Hmm ... in gathering the image links for you I discovered that my base image ('shirt.jpg') has some sort of error that prevents it from being displayed in the web browser. I've been noticing lately that Photoshop images saved as jpgs seem to have errors unless you specifically use the "Save for Web" feature. I won't be able to get an error-free file until Monday, but I imagine that could fix my problem. Until then, here are the image links anyway:
The shirt: http://www.graphichabit.com/redesign/im ... /tee_l.jpg
The design: http://www.graphichabit.com/redesign/im ... dina01.jpg
The results: http://www.graphichabit.com/redesign/im ... l/test.jpg (when using convert -compose);
http://www.graphichabit.com/redesign/im ... test-0.jpg (when using compose [A]);
http://www.graphichabit.com/redesign/im ... test-1.jpg (when using compose ).
Re: Compose image yields odd results
As you say there is an error on the shirt jpg as when I download and try opening it I get the following errors:
P.S. Searching google for " photoshop Corrupt JPEG data: extraneous bytes before marker " I found other people have had this problem and some old IM posts about it. Seems IM could cope with it as somebody could open similar corrupted images in 3.9.2
Premature end of JPEG file Exif data will be ignored.
Corrupt JPEG data: 167854 exteneous bytes before marker 0xd9 Exif data will be ignored.
JPEG downstream contains no image Exif data will be ignored.
P.S. Searching google for " photoshop Corrupt JPEG data: extraneous bytes before marker " I found other people have had this problem and some old IM posts about it. Seems IM could cope with it as somebody could open similar corrupted images in 3.9.2
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Compose image yields odd results
More than likely that former open success was removed during various JPEG library upgrades.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Compose image yields odd results
Now that I have an error free file on the server, the "convert" command works wonderfully. The "composite" command still yields two, non-composited files. Any idea why that would be happening?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Compose image yields odd results
That is strange as while convert can generate two images, composite can NOT.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/