Reputation: 41
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.
Upvotes: 0
Views: 1685
Reputation: 11
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
Upvotes: 1