-
-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
image.MetaData.HorizontalResolution is not correct, returns 1, and file properties shows 96 #490
Comments
Hi @steven-gong Can you please try this again using the issue template. We cannot accept issues without them |
Thanks, that's much better! Can you test the image against the latest build. I'm fairly certain we fixed this since beta 2 Cheers James |
This bug is present in both beta 3 and beta 4. And this code:
|
Thanks for reporting this. This is interesting. We're actually reading the correct density units from the image but what we are reporting back though is the aspect ratio not the resolution. https://en.wikipedia.org/wiki/JPEG_File_Interchange_Format#Resolution_and_aspect_ratio Here's the second image using aspect ratio density units. Here's an image using the resolution density units. I'm wondering whether there is a better way of expressing this. @dlemstra how does ImageMagick report it back to the user? Perhaps we should add the following enumeration to the /// <summary>
/// Provides enumeration of available pixel density units.
/// </summary>
public enum DensityUnits : byte
{
/// <summary>
/// No units; width:height pixel aspect ratio = Ydensity:Xdensity
/// </summary>
AspectRatio = 0,
/// <summary>
/// Pixels per inch (2.54 cm)
/// </summary>
PixelsPerInch = 1, // Other image formats would default to this.
/// <summary>
/// Pixels per centimeter.
/// </summary>
PixelsPerCentimeter = 2
} |
Hey @steven-gong @NickyM I've introduced #649 to improve resolution handling within the library. Once merged you'll also know what unit of measurement is used when querying resolution metadata. Explorer is talking absolute nonsense for both the images in this issue. |
Prerequisites
DEBUG
andRELEASE
modeDescription
I'm using the imagesharp to load a test image, and validate its resolution, however the tested image got both vertical and horizontal resolutions are 96, but the loaded image MetaData resolutions by ImageSharp are 1, which is expected to be 96.
Steps to Reproduce
var fileStream = new FileStream("96Resolution.jpg", FileMode.Open);
IImageFormat format;
var image = Image.Load(fileStream, out format);
if (image.MetaData.HorizontalResolution < 72){ .... }
Here image.MetaData.HorizontalResolution = 1
Just attached my test image.
System Configuration
The text was updated successfully, but these errors were encountered: