How can I got the Resolution of a image

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Locked
tjyzwz
Posts: 2
Joined: 2019-11-04T20:25:09-07:00
Authentication code: 1152

How can I got the Resolution of a image

Post by tjyzwz »

We use command to get this information.
string args = "-format \"w=%w;h=%h;r=%x;c=%[colorspace]\" \"" + mImagePath + "\"";
case "r":
string[] valueAndUnits = keyValue[1].Split(new[] { ' ' });
double resolution;
if (double.TryParse(valueAndUnits[0], out resolution))
{
// if the units are in centimeters, convert it to inches
if (valueAndUnits[1] == "PixelsPerCentimeter")
{
resolution = resolution * 2.54;
}
}

Now we want fetch this information by api
Can you tell me the property or related method?
thanks

User avatar
dlemstra
Posts: 1625
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: How can I got the Resolution of a image

Post by dlemstra »

It looks like you are looking for image.Density.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

tjyzwz
Posts: 2
Joined: 2019-11-04T20:25:09-07:00
Authentication code: 1152

Re: How can I got the Resolution of a image

Post by tjyzwz »

thank you very much.

Locked