magick.net

Using Magick.NET with C#

∥☆過路亽.° 提交于 2021-02-07 08:52:36
问题 I am trying to implement a functionality using Magick.NET in C#. Previously I was using:- // Convert to a png. Process p = new Process(); p.StartInfo.FileName = @"C:\Program Files\ImageMagick-6.2.8-Q16\convert.exe"; p.StartInfo.Arguments = "-scale 60% \"" + svg + "\" \"" + png + "\""; p.StartInfo.CreateNoWindow = true; p.Start(); p.WaitForExit(); TransmitFile(context, png); I want to move away from having to store convert.exe on the server.....Now I want to use something that will be in code

Using Magick.NET with C#

蓝咒 提交于 2021-02-07 08:51:42
问题 I am trying to implement a functionality using Magick.NET in C#. Previously I was using:- // Convert to a png. Process p = new Process(); p.StartInfo.FileName = @"C:\Program Files\ImageMagick-6.2.8-Q16\convert.exe"; p.StartInfo.Arguments = "-scale 60% \"" + svg + "\" \"" + png + "\""; p.StartInfo.CreateNoWindow = true; p.Start(); p.WaitForExit(); TransmitFile(context, png); I want to move away from having to store convert.exe on the server.....Now I want to use something that will be in code

Using Magick.NET with C#

狂风中的少年 提交于 2021-02-07 08:51:19
问题 I am trying to implement a functionality using Magick.NET in C#. Previously I was using:- // Convert to a png. Process p = new Process(); p.StartInfo.FileName = @"C:\Program Files\ImageMagick-6.2.8-Q16\convert.exe"; p.StartInfo.Arguments = "-scale 60% \"" + svg + "\" \"" + png + "\""; p.StartInfo.CreateNoWindow = true; p.Start(); p.WaitForExit(); TransmitFile(context, png); I want to move away from having to store convert.exe on the server.....Now I want to use something that will be in code

[Hei.Captcha] Asp.Net Core 跨平台验证码实现

六月ゝ 毕业季﹏ 提交于 2020-10-24 07:55:31
写在前面 说起来比较丢脸。我们有个手机的验证码发送逻辑需要使用验证码,这块本来项目里面就有验证码绘制逻辑,.Net Framework的,使用的包是 System.Drawing ,我把这验证码绘制逻辑复制到.Net Core的新项目引用对比包 System.Drawing.Common ,windows下面验证码正常,CentOs下面死活不能正常,像这样: (左边为CentOs运行结果,右为Windows) 依赖库检查安装; 字体检查安装; 逻辑检查; 折腾了一天多放弃了,决定重新写。 我看了市面上的各种验证码,使用第三方的,免费的都有很多限制,并随时有可能开始收费(用户量上去后就收费,俗称“养猪”); 有些比较大平台的已经开始收费或者即将收费(无可厚非,不点名); 视野有限,没有都一一了解到,如果有免费的,限制又比较少的,使用体验不错的第三方验证码,欢迎留言~~ 综上,我决定自己绘制 选择图片绘制库 GitHub上面我看到比较多星的是: SixLabors / ImageSharp dlemstra / Magick.NET mono / SkiaSharp 综合考虑后选择了:ImageSharp 官方文档:https://sixlabors.github.io/docs/ 成果 Hei.Captcha 一个.net core,跨平台的验证码生成工具包,基于ImageSharp

Reduce image size imagemagic

≯℡__Kan透↙ 提交于 2019-12-24 00:12:04
问题 I have tried to compress image but has no success. Look at my small experiment var results = new Dictionary<int, int>(); for (int i = 0; i <= 100; i++) { var stream = new MemoryStream(); image.Quality = i; image.CompressionMethod = CompressionMethod.Zip; image.Write(stream, MagickFormat.Png); results[i] = stream.GetBuffer().Length; stream.Flush(); } var best = results.OrderBy(e => e.Value).First(); // the same length as for original image. quality doesn't work in this example - dictionary

Unable to find an entry point named 'Environment_SetEnv' in DLL 'Magick.NET-Q8-x64.Native.dll'

十年热恋 提交于 2019-12-23 10:04:50
问题 Upgraded to latest ImageMagick / Magick.NET (7.0.2.901), and it built and ran fine locally, but explodes on the server with this error. Unable to find an entry point named 'Environment_SetEnv' in DLL 'Magick.NET-Q8-x64.Native.dll'. Seems to be a new issue. Judging by the change desc here: https://magick.codeplex.com/discussions/650746 The VC Runtimes are no longer required, so installing them wouldn't be the issue - and, I've installed 2008, 2012 and 2015 VC runtimes for prior versions of the

Find Tables in Image using C#

99封情书 提交于 2019-12-23 05:22:47
问题 I am trying to write a function that will take an image and return me a list of images with only tables using EMGU.CV or Magick.Net or AForge.Net for example for the below image the function should return 2 images with the two tables in the image. private static List<Image> FindTables(Image img) { var masterImage = (Bitmap)img; var image = new Image<Gray, byte>(masterImage); var copyImg = new Image<Bgr, byte>(masterImage); List<Image> tables = new List<Images> //Find all tables and add to

Find Tables in Image using C#

爷,独闯天下 提交于 2019-12-23 05:22:13
问题 I am trying to write a function that will take an image and return me a list of images with only tables using EMGU.CV or Magick.Net or AForge.Net for example for the below image the function should return 2 images with the two tables in the image. private static List<Image> FindTables(Image img) { var masterImage = (Bitmap)img; var image = new Image<Gray, byte>(masterImage); var copyImg = new Image<Bgr, byte>(masterImage); List<Image> tables = new List<Images> //Find all tables and add to

Error with ImageMagick and Ghostscript converting from PDF

一个人想着一个人 提交于 2019-12-11 05:19:17
问题 We are using Magick.Net version 7.0 with Ghostscript 9.16. We are reading in a PDF and converting this to a tif or a jpg image. Everything is working fine when we run these through one at a time and our PDF gets converted. This is an application that will be hit by many systems, so we put a small load test to ensure we could handle multiple requests. Everything runs great as long as we use different PDF files. If we try and run the same PDF file through multiple times (doing 5 requests at the

GIF image loses its animation in Magick.net

孤街醉人 提交于 2019-12-08 12:46:16
问题 I am reading a GIF image and creating the ImageMagick object in C#. Then I write the same image to the output. In the output I get a static image without animation. MagickImage image = new MagickImage(ImagePath); Byte[] buffer = image.ToByteArray(); HttpContext.Current.Response.ContentType = "image/gif"; HttpContext.Current.Response.OutputStream.Write(buffer, 0, buffer.Length); HttpContext.Current.Response.StatusCode = 200; 回答1: A MagickImage is a single image. When you read a .gif file you