Alternatives to System.Drawing for use with ASP.NET?

There is an excellent blog post including C# code about using the ImageMagick graphics library through Interop over at TopTen Software Blog. This post deals specifically with running ASP.net on linux under mono; however, the C# code should be perfectly copy-paste-able, the only thing you’ll need to change is the Interop attributes if you are … Read more

How to find reason for Generic GDI+ error when saving an image?

While I still did not find out the reason what exactly caused the error when saving the image, I found a workaround to apply: const string i1Path = @”c:\my\i1.jpg”; const string i2Path = @”c:\my\i2.jpg”; var i = Image.FromFile(i1Path); var i2 = new Bitmap(i); i2.Save(i2Path, ImageFormat.Jpeg); I.e. by copying the image internally into a Bitmap instance … Read more

Manipulating images with .NET Core

Disclaimer: This is my software. I’m working on a cross-platform 2D Graphics library that runs on .NET Core It’s currently alpha but already supports a comprehensive feature set. https://github.com/JimBobSquarePants/ImageSharp Example usage. using (FileStream stream = File.OpenRead(“foo.jpg”)) using (FileStream output = File.OpenWrite(“bar.jpg”)) { Image image = new Image(stream); image.Resize(image.Width / 2, image.Height / 2) .Greyscale() .Save(output); … Read more

c# Image resizing to different size while preserving aspect ratio

This should do it. private void resizeImage(string path, string originalFilename, /* note changed names */ int canvasWidth, int canvasHeight, /* new */ int originalWidth, int originalHeight) { Image image = Image.FromFile(path + originalFilename); System.Drawing.Image thumbnail = new Bitmap(canvasWidth, canvasHeight); // changed parm names System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(thumbnail); graphic.InterpolationMode = InterpolationMode.HighQualityBicubic; graphic.SmoothingMode = SmoothingMode.HighQuality; graphic.PixelOffsetMode = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)