我正在使用以下代码来调整图像大小。现在,我需要使用Magick.NET在此图像上应用水印。
var response = client.GetObject(request).ResponseStream;
MagickImage image = new MagickImage(response);
MagickGeometry size = new MagickGeometry(imgWidth, imgHeight);
size.IgnoreAspectRatio = maintainAspectRatio;
image.Resize(size);
Bitmap watermarkObj = (Bitmap)Bitmap.FromFile("G:/Images/watermark.png");
Graphics imageGraphics = Graphics.FromImage(image.ToBitmap());
Point point = new Point(image.Width - 118, image.Height - 29);
imageGraphics.DrawImage(watermarkObj, point);
image.write("G:/Images/ProcessedImage.JPG");
工作代码:
MagickGeometry size = new MagickGeometry(imgWidth, imgHeight);
size.IgnoreAspectRatio = maintainAspectRatio;
image.Resize(size);
Bitmap watermarkObj = (Bitmap)Bitmap.FromFile("G:/Images/watermark.png");
Bitmap objImg = new Bitmap("G:/Images/OriginalImage.jpg");
Graphics imageGraphics = Graphics.FromImage(objImg);
Point point = new Point(image.Width - 118, image.Height - 29);
imageGraphics.DrawImage(watermarkObj, point);
objImg.save("G:/Images/ProcessedImage.JPG");
那么,谁能帮助我如何使用 imagemagick 来做到这一点?原因是当我在图形中传递 imageObject 时,它不会应用水印,而当我传递 .net 图像对象时,它会应用水印。