给出一张图片:
还有一个水印:
代码:
var originalImageBytes = originalFile.FileBytes();
// Draw watermark
using (var ms = new MemoryStream(originalImageBytes))
using(var originalImage = Image.FromStream(ms))
using (var watermark = Image.FromFile(Settings.FSO.RootNonPublicDirectory + "Images/Watermark/Watermark.png"))
using (var g = Graphics.FromImage(originalImage))
{
g.DrawImage(watermark, 0, 0);
using (var msOut = new MemoryStream())
{
originalImage.Save(msOut, ImageFormat.Jpeg);
return msOut.ToArray();
}
}
产生以下结果:
请注意,尺寸正确但图像底部的一大块缺失。
右键单击并save-as
将此图像保存到我的磁盘上,看起来已损坏:
有谁知道这里发生了什么?