I can't preview the image after I resize it

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
jedatkinports
Posts: 5
Joined: 2018-11-15T04:25:57-07:00
Authentication code: 1152

I can't preview the image after I resize it

Post by jedatkinports » 2018-11-15T08:36:46-07:00

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

jedatkinports
Posts: 5
Joined: 2018-11-15T04:25:57-07:00
Authentication code: 1152

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

Post by jedatkinports » 2018-11-15T08:38:38-07:00

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);

User avatar
fmw42
Posts: 24140
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post by fmw42 » 2018-11-15T09:42:07-07:00

With ImageMagick 7 command line mode, you should use just "magick" and not "magick convert"

Post Reply