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

New Post: Tranform Composite operation with dissolve from ImageMagick CLI

$
0
0
Hello,

I am using ImageMagick.NET 6.8.9-7 (Windows 7 64-bits) to generate a preview image with watermark. The problem is that I don't know how to properly transform the command-line command into its counterpart in Magick.NET library (recently downloaded file Magick.NET-7.0.0.0001-Q8-x86-net40-client.zip).

The command-line command I use is this:
convert MyImage.jpg -resize x384 -sharpen 0x0.75 miff:- | composite -dissolve 11 -tile C_watermark.png - Preview.jpg
Roughly,
  1. Resize the image (MyImage.jpg) and sharpen it 0.75
  2. Composite the resized image with a copyright (C_watermark.png), using a dissolve method (src_percent=11) and tiling option
The problem is the dissolve method, which I don't know how to transform. In the following excerpt you would find the c# code transformation I have been working with:
  MemoryStream resultStream = null;
  string sourcePath = "MyImage.jpg";
  using (MagickImage image = new MagickImage(sourcePath))
  {
      // Scaling
      System.Windows.Size destSize = new Size(259, 384);
      image.Resize(Convert.ToInt32(destSize.Width), Convert.ToInt32(destSize.Height));
      image.Sharpen(0.75, 1);
      // Combining watermark
      string watermarkFileName = Path.Combine(SetupSection.PathWatermark, "C_watermark.png");
      using (MagickImage watermark = new MagickImage(watermarkFileName))
      {
          resultStream = new MemoryStream();
          image.Composite(watermark, 0, 0, CompositeOperator.Dissolve, "11");
          image.Write(resultStream);
      }
      // Writing resulting image
      image.Write("Preview-CSharp.jpg");
  }
  resultStream.Close();
Note. The tiling option is not mandatory, as I can tile the image myself.

You can download the source and watermark images from the following link, and also the resulting images:
https://plus.google.com/photos/100028387994322590166/albums/6049973551020455761?authkey=CKr_9-ec1LeLxgE


Any help would be very much appreciated.

Best regards,
Xavier de Palol.

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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