This project has moved and is read-only. For the latest updates, please go here.


Jul 8, 2013 at 2:05 PM

How do I change the DPI for an existing image? I want to set it to 96.

I guess this is the Density property on the image but I've not been able to get it to work as required yet.


Jul 8, 2013 at 2:18 PM
Can you provide me with a code sample and an example image?
Oct 21, 2013 at 7:05 PM
Hi Russell,

Have you been assisted with this yet, or have you figured out how to do this? This is one of the properties I have been trying to get working in Magick.NET as well.

Feb 4, 2014 at 7:42 PM
I'm also having trouble with the density feature. It show the correct ResolutionX and ResolutionY when I set the image.Density, but the end image is still the same DPI as the original.

Thank You,
Feb 27, 2014 at 1:49 PM
I am having the exact same issue. Has anyone found a resolution to this? I'm using MagickNet -x64 installed from the nuget package.

Thanks, Tim
Feb 27, 2014 at 2:04 PM
Can you provide me with a code sample and an example image?
Feb 27, 2014 at 2:24 PM
For the code, the line I'm using is:

testImage.Density = new MagickGeometry(72);

As for the image, I'm not sure how to attach it to this reply. It's about 50 mg, 865x865. When I do a straight conversion from .eps to .jpg, the DPI shows 300dpi, which is fine. I'm just not sure how to change it to 72dpi when converting to .jpg.

Let me know if you need anything else. or how I could attaché my image.
Feb 27, 2014 at 2:41 PM
ImageMagick does not update the density in the profiles. When you view it in Windows explorer it can still be using the value in the profiles. Can you try adding testImage.Strip() before you do testImage.Write?
Feb 27, 2014 at 3:02 PM
Yep. .Strip() fixed me. Thanks. Really appreciate your time.
Feb 27, 2014 at 4:12 PM
Can you post your image on DropBox or a public image sharing service? Feel free to contact me through CodePlex if you don't want to share it publicly. I would like to investigate if I can update the profile in the image.
Feb 27, 2014 at 5:51 PM

Let me know if you can't download it.
Feb 27, 2014 at 6:36 PM
Also, there does appear to be some images that imagemagick just will not convert to a desired dpi. For instance,

will not convert to .jpg at 72 dpi or 300 dpi. It always converts it to 96 dpi. Is this an issue or does it have something to do with size, compression, etc. of the image itself. ?

Feb 27, 2014 at 10:25 PM
Edited Feb 27, 2014 at 10:26 PM
The problem with your images seems to be the 8BIM profile. When you remove this profile file explorer will show the correct value.

Your second image does not show the correct DPI because the ResolutionUnits value is undefined. You can get the required result with the following code:
using (MagickImage image = new MagickImage("11267DVDLEF.eps"))
  image.Density = new MagickGeometry(72, 72);
  image.ResolutionUnits = Resolution.PixelsPerInch;
I am currently investigating if we can change ImageMagick to update the 8BIM profile, I will keep you updated.
Feb 28, 2014 at 1:17 PM
Thanks. That fixed me. As you can probably tell, I'm a little light with my knowledge of images. Thanks for your help.
Mar 1, 2014 at 12:06 PM
I just modified ImageMagick to update the 8BIM profile when an image is written. The next release of Magick.NET will include this fix. This means you no longer need to strip the 8BIM profile. I will also change the Density property to set the ResolutionUnits to PixelsPerInch if ResolutionUnits is undefined.
Mar 3, 2014 at 2:07 AM
Edited Mar 3, 2014 at 2:09 AM
Sweet. Thanks. Thanks for the effort.

I do have one final question. All of my image conversions are working very well except for one. It's fairly large, about 700mb. I do not get an error. My code acts as if the file converts, but the final file is only like 200kb. So, clearly it did not convert properly. Should I have any concerns about converting an image that size? It's possible that it could be my own machine limitations, but wanted to double check with you first. If you are able to convert this file, then I'll figure out a way. A code snippet would be nice, but not a big deal.

I'm trying to convert the 700mb file to .jpg 300dpi.
Mar 3, 2014 at 2:50 PM
It seems the XMP profile in your file is very large. Under windows this generates a JPEG file that cannot be opened with the default image viewer of Windows. I will have to investigate if we can fix this problem. You could use image.RemoveProfile("XMP") to resolve this problem.