Page 1 of 1

I can't preview the image after I resize it

Posted: 2018-11-15T08:36:46-07:00
by jedatkinports
I tried it with the CLI tool and in C# with Magick.NET. I get the same result. After the resize, I can't preview the image anymore.

When I try to open the image for preview I get this message: "Windows Photo Viewer can't open this picture because the file appears to be damaged, corrupted, or too large.".

CLI command which I have used:

Code: Select all

magick convert -resize 1024 123_original.jpg 123_resized.jpg
And this is the C# code:

Code: Select all

using (MagickImage image = new MagickImage(destinationImagePath))
{
    if (newWidth < image.Width)
    {
        image.Resize(newWidth, 0);
    }

    image.Write(destinationImagePath);
}
This is the original image: https://ufile.io/x1d1u
This is the resized image: https://ufile.io/rlc04

Re: I can't preview the image after I resize it

Posted: 2018-11-15T08:38:38-07:00
by jedatkinports
I was too fast with this post. I just added the sRGB colorspace and it's working fine.

Code: Select all

image.AddProfile(ColorProfile.SRGB);

Re: I can't preview the image after I resize it

Posted: 2018-11-15T09:42:07-07:00
by fmw42
With ImageMagick 7 command line mode, you should use just "magick" and not "magick convert"