Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Question about composite command and images of different sizes

$
0
0
Hello,
I'm trying to apply a watermark to an image.
I've got an example image that is 1024x768 and a watermark image that is 584x116.
I'm resizing the watermark to match the example, then using the composite command to merge the two images.
using (MagickImage image = new MagickImage("example.jpg"))
{
 using (MagickImage watermark = new MagickImage("watermark.png"))
  {
           //resize watermark to fit the proof image
           watermark.Resize(image.Width,image.Height);
 
           image.Composite(watermark, Gravity.Center, CompositeOperator.Dissolve, "11");
           image.Write("examplewatermarked.png");
   }
}
The result is an image with solid black on the top and bottom, while the middle where the watermark is applied is displaying correctly. Looking at the watermark after the resize command, the height is scaled up as expected but it does not match the example image's canvas height (768). Is there any way to make the result not black if the canvas size doesn't match?
I'm sure there is something simple I'm missing in order to make it work.

Thanks for any help.

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>