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:
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.
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,- Resize the image (MyImage.jpg) and sharpen it 0.75
-
Composite the resized image with a copyright (C_watermark.png), using a dissolve method (src_percent=11) and tiling option
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.