嘿,伙计们,我可以知道如何使用图像处理器类库吗?我登录了提供者网站"https://imageprocessor.org/“,但是使用它没有什么问题,非常感谢您的时间,非常感谢您的帮助
发布于 2020-02-21 07:29:57
在他们的网站上,有一个关于ImageFactory类的文档,其中包含每个方法的演示代码,并显示结果。你可以在这里找到它:ImageFactory
下面是从他们的文档中获取的一个完整的示例,用于加载图像并对其进行一些操作并保存:
byte[] photoBytes = File.ReadAllBytes(file);
// Format is automatically detected though can be changed.
ISupportedImageFormat format = new JpegFormat { Quality = 70 };
Size size = new Size(150, 0)
using (MemoryStream inStream = new MemoryStream(photoBytes))
{
using (MemoryStream outStream = new MemoryStream())
{
// Initialize the ImageFactory using the overload to preserve EXIF metadata.
using (ImageFactory imageFactory = new ImageFactory(preserveExifData:true))
{
// Load, resize, set the format and quality and save an image.
imageFactory.Load(inStream)
.Resize(size)
.Format(format)
.Save(outStream);
}
// Do something with the stream.
}
}下面是他们文档中的一个示例: Change backgroundColor:
public ImageFactory BackgroundColor(Color color)作物图像:
public ImageFactory Crop(Rectangle rectangle)改变决议:
public ImageFactory Resolution(300, 300)向图像添加水印:
public ImageFactory Watermark (TextLayer textLayer)还有更多的。只要导航到网址,你就会找到所有的人。
https://stackoverflow.com/questions/60332980
复制相似问题