composite three images goes wrong

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
st3v3n

composite three images goes wrong

Post by st3v3n »

i composite three images together and it works pretty damn well - but i have one big problem...

my command looks like this:
composite image.jpg texture.jpg overlay.jpg -compose hard-light output.jpg

which works very, very good BUT the texture image is 1024x1024 and the image.jpg and the overlay.jpg are 256x256px - the resulting image is the texture image with the two smaller images in the top left corner... any idea how i can tell composite to crop down the texture by the size of image.jpg?


thanks so much!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: composite three images goes wrong

Post by fmw42 »

I am not sure I understand what you are doing with 3 image composite. The third must be a mask. see http://www.imagemagick.org/Usage/compose/#mask

Perhaps you can post links to your input and output images.

However, the only way to get the images the same size is to measure them via

size=`convert image -format "%wx%h" info:`

and then use $size for cropping the image subsequently. Neither composite nor convert will do that automatically during a composite operation to my knowledge
st3v3n

Re: composite three images goes wrong

Post by st3v3n »

the third is a mask - which turned out to be an empty image because my imagemagick version doesnt support "-alpha extract" (kinda sucky)...
well the best output would be having image1.jpg being overlayed with a texture (bigger image as image1.jpg) with ~40% opacity and being hard-light (only on bright colors) overlayed over image1.jpg...
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: composite three images goes wrong

Post by anthony »

For older IM's their are a number of ways to extract alpha....
These are details
http://www.imagemagick.org/Usage/channels/#extract
Included in there is one method dating back to IM v5

Three image composition see..
http://www.imagemagick.org/Usage/compose/#mask
was only finalized with proper 'mask based limits' in IM v6.3.5
Before this the mask image was only meged into the alpha channel of the source image
For details of this old version see
Composite Mask Bug
http://www.imagemagick.org/Usage/bugs/composite_mask/
This also details exactly what it does, and what it previously did.

In may ways the mask is applied in much that same way that -mask works for
Image Modification Operators
In limiting what parts of an image can be modified.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply