I am using Magicknet for image manipulation in my ASP.NET project. How can I Get & SET the image resolution of the image? - When I resize a 300 pixel/inch image it apparently by default result in a 72 pixel/inch image, and because I maintain the same size, I get a very low quality image. So I need to be able to maintain the ppi of the image.
I also want to add that this might result in either magicknet or System.Drawing.Image, but I am not 100% sure.
The code that I'm using:
img.ModulusDepth = 10;
img.Compression = CompressionType.JPEGCompression;
img.Quality = 80;
string optimizedImage = System.Web.HttpContext.Current.Server.MapPath(".") + "\\temp\\" + Guid.NewGuid().ToString() + ".jpg";
img.Write(optimizedImage); // save optimized image as temp file
Magick.Term();
System.Drawing.Image tempimage = System.Drawing.Image.FromFile(optimizedImage); // load the optimized image into an image objec
From what I've read here, the default ias 72 pixels per inch.
Thanks
Image DPI is quite irrelevant in the context of the web; it's a metadata setting ignored by all browsers and nearly all printers.
Pixels are the units with which you must work; DPI is a leaky abstraction handled differently by every library and UI.
You might also consider using a server-safe alternative to Magicknet.