0

Any idea on how to get an image dimensions in asp.net core, knowing that System.Drawing.Image doesn't work on this version. This is how I am actually reading the image:

byte[] data = File.ReadAllBytes("path_to_image");
return data;

i.e.: Can I find the Height and Width of an image in its byte[] representaion?

Any help in how to rotate the image is also welcome.

3

1 Answer 1

1

You want bytes 11-12 for Horizontal resolution, and 13-14 for Vertical resolution. Assuming you're talking about a JPEG image. And byte 10 gives you the unit type (dots per inch or dots per cm)

https://www.w3.org/Graphics/JPEG/jfif3.pdf

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.