0
votes

I’m hoping someone can point me in the right direction.

I’ve been trying to use GraphicsMagick to composite three images with a small tweak to one of the colours as well.

The first two images are the same size and are positioned at 0, 0. The third image is smaller, a “design” image and I’ve offset this using –page 320,300.

Everything seems fine up to mosaic.

When I do the resize I would have hoped after the mosaic for the whole image to be resized as one but instead it apples the resize to each of the layers, leaving the third image resized incorrectly.

Is there a way I can solve the resize to work here?

Here is the command I am using:

gm convert -background transparent background.png -compose multiply -fill "#FFCCAA" \
    -opaque "#FFFFFF" foreground.png -page +320+300 design.png -mosaic \
    -resize 300x300 result.png

Added example of problem: http://imgur.com/bQutJKh

1
Not near a computer, but try -flatten before -resize.Mark Setchell
Thanks for the suggestion. I put this right before the –resize parameter and the only difference is the background becomes black rather than transparent. imgur.com/a/creAADrBeza
Just had another look - if you use -compose multiply, you would normally issue -composite after each additional image, and use -geometry +320+300 rather than -page for positioning.Mark Setchell
@MarkSetchell again thanks for the suggestions. I switched -page to -geometry but –composite is an unrecognised option I'm being told. As a test I stripped it right back to: gm convert bg.png -geometry +320+300 design.png -mosaic -resize 300x300 result.png the resize problem remains. Using –flatten crops the image to the size of the first image. Is it because I’m using convert? I added a couple of images to that imgur link that might help.DrBeza
I'll check it in the morning...Mark Setchell

1 Answers

1
votes

Not sure if this helps, but it may be what you seek. Start with a.png and b.png which are both 300x300 and c.png which is 100x100.

enter image description here

enter image description here

enter image description here

Now composite b onto a and resize c and composite and resize the result:

gm convert a.png -draw "image multiply 0,0 0,0 b.png" -draw "image multiply 100,150 30,30 c.png" -resize 800x300! result.png

enter image description here