Skip to content

MagickImage.ToBitmapWithDensity() throws Parameter is not valid exception #1419

@d2phap

Description

@d2phap

Magick.NET version

13.2.0

Environment (Operating system, version and so on)

Windows 11 22H2

Description

Reported from d2phap/ImageGlass#1622

When reading this file with .ToBitmapWithDensity()

It throws exception on the bitmap.SetResolution:
image

   at System.Drawing.Bitmap.SetResolution(Single xDpi, Single yDpi)
   at ImageMagick.IMagickImageExtentions.SetBitmapDensity[TQuantumType](IMagickImage`1 image, Bitmap bitmap)
   at ImageMagick.IMagickImageExtentions.ToBitmap[TQuantumType](IMagickImage`1 self, Boolean withDensity)
   at ImageMagick.IMagickImageExtentions.ToBitmapWithDensity[TQuantumType](IMagickImage`1 self)

I would be nice if MagickNET can ignore the error!

Steps to Reproduce

using var imgM = new MagickImage();
imgM.Read(@"256815987-31008961-f200-4f85-b250-3e54e8d747ed.jpg", new MagickReadSettings());

var aaa = imgM.ToBitmapWithDensity(); // 🫠

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions