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

MagickImage.Resample has no effect

Sep 5, 2014 at 2:53 PM
I'm using the following code:
public static void InPlaceResample(string source, int width, int height)
    using (var image = new MagickImage(source))
        image.Resample(width, height);
The method is intended to change only the DPI of an image, but when running through the debugger the ResolutionX and ResolutionY properties are not changed by calling Resample. Am I missing something?
Sep 5, 2014 at 3:01 PM
If you only want to change the DPI you should use the Density property. Your method signature has a width/height and not a DPI. Are you sure you only want to set the DPI of the image?
Sep 5, 2014 at 3:09 PM
I tried the Density property, and it did indeed change the DPI to what I want (300 to 200 squared in my test), but the scale decreased dramatically from 2550x3300 to, if I recall correctly, something like 150x200. I'd like the scale to remain as close to the same as the original if possible, since as it is the document becomes unreadable.
Sep 5, 2014 at 4:29 PM
Hmm, trying again it seems to work fine with the Density property. Maybe I had something else in there mucking things up.