[Mono-aspnet-list] Improve image resizing quality

Daniel Lo Nigro lists at dan.cx
Sat Mar 16 04:30:05 UTC 2013


Microsoft's .NET Framework uses GDI+ (which is a part of Windows) whereas
Mono uses libgdiplus <http://www.mono-project.com/Libgdiplus> which is a
wrapper around the Cairo graphics library <http://www.cairographics.org/>.
This is why you're seeing differences between the two.

The link you posted uses the ImageMagick library, which is something I'd
recommend if you're not happy with the quality of the System.Drawing
output. ImageMagick (or GraphicsMagick, which is a fork of it) is what I
use with PHP and Node.js and it works pretty well. If you don't want to
mess around with P/Invoke and native libraries, you could just use
System.Diagnostics.Process to run ImageMagick. Just get it working
perfectly from the command-line, and then copy the command into your app :).

See the ImageMagick docs: http://www.imagemagick.org/Usage/resize/#resize


On Sat, Mar 16, 2013 at 4:47 AM, Patrick Epstein <epstone2 at gmail.com> wrote:

> Hello,
>
> I'm resizing images with the same c# code on windows and linux and the
> results on linux are worse. Just a bit less than acceptable.
> What should I do to get comparable good results?
>
> What I'm doing right now:
>
>  image.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone);
>  image.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone);
>
> var resized  =  resizedImage = image.GetThumbnailImage(width, height,
> null, IntPtr.Zero);
>
>  var encoderParameters = new EncoderParameters(1);
>  encoderParameters.Param[0] = new
> EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 90);
>
> saving...
>
> Or is this the way to go?
>
> http://www.toptensoftware.com/Articles/17/High-Quality-Image-Resampling-in-Mono-Linux
>
> Best regards,
> Patrick
>
> _______________________________________________
> Mono-aspnet-list mailing list
> Mono-aspnet-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-aspnet-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20130316/38c890fd/attachment.html>


More information about the Mono-aspnet-list mailing list