composite merge two images: black turns to grey

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jom1

composite merge two images: black turns to grey

Post by jom1 »

I have two images:
1. logo.png with solid black text and a solid red shape (the background is transparent),
2. a normal photo.

Why, when I use composite to put the logo on the photo, instead of a nice black and red logo which stands out, the black looks grey, and the red shape is "washed out"?

Shouldn't the logo simply be 'stuck' onto the photo, with only the transparent part showing through?

The command I used is:
composite -geometry +740+0 logo.png photo.psd photo2.jpg

I'm new to this, and haven't been able to find a solution, because there is a lot I don't understand. I'd be grateful for any help.
gsso

Re: composite merge two images: black turns to grey

Post by gsso »

Yeah, just checked, it does act strange.
If you have more than one layer it kind of merges it with a difference blend mode?

the "logo":
Image

image inside the psd with one empty layer:
Image

the result:
Image


Well, what you can do for now is first save the photo.psd as photo.jpg and then put the logo on top of it:

convert photo.psd -flatten photo.jpg
composite logo.png photo.jpg photo2.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: composite merge two images: black turns to grey

Post by fmw42 »

The command I used is:
composite -geometry +740+0 logo.png photo.psd photo2.jpg
Photoshop files have several layers. The first layer will be the flattened image. So if you do not specify the layer, you will get all layers and the flattened layer as well

try

photo.psd[0]

but this may lose the transparency. You may have to select the photoshop layers you need photo.psd[1-x] and skip the flattened layer.

Sorry not an expert on photoshop files.

Can you provide a link to each of your input images (and possibly your output) so we can see what is going on?
jom1

Re: composite merge two images: black turns to grey

Post by jom1 »

Thanks gsso - your example shows the problem well.

I tried first saving the psd as a jpg as suggested, and it worked!

It seems like this is a problem with psd files.

My psd file only has one layer.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: composite merge two images: black turns to grey

Post by fmw42 »

If it has an overlay, then it likely has more than one layer as IM would see it.

type

identify image.psd

and see how may lines it prints. each layer will be listed as image.psd[0], image.psd[1] etc. Perhaps everything has been flattened already into just the [0] layer, but then I would not have expected it to have transparency. But I am no expert on PSD files.

If you post links to your images, then others can look more carefully and make better recommendations
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: composite merge two images: black turns to grey

Post by anthony »

PSD images can also save the composition mode used to merge image layers.

You may need to set an appropriate -compose setting before using -composite to override any existing composition mode that may have been present.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply