LoadImageInfo does not return correct values for width and height if image is from mobile phone and image is in portrait mode
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 583
- Forks
- 169
- PR merge metrics
- No merged PRs in 30d
Description
As per the title, if I want to get width/height of an image in portrait mode from a mobile phone, the width and height are incorrect (width is wider that height).
I use this code to call the method:
using (var stream = imageBlob.OpenRead())
{
string[] info = new[] { "source.width", "source.height", "final.width", "final.height", "result.ext", "result.mime" };
var length = stream.Length; // set length before calling LoadImageInfo
var result = CurrentImageBuilder.LoadImageInfo(stream, info);
return new Tuple<int, int, long>((int)result["source.width"], (int)result["source.height"], length);
}
Is there some setting I am missing in the call to LoadImageInfo (i.e in info)?
I've found code here on github that seems to indicate that you do actually autorotate by default for some calls (in ImageBuilder.PostDecodeStream), but I am unsure if this code is > 4.2.8 or not called when calling LoadImageInfo.
We are currently on ImageBuilder 4.2.8
Thanks
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with LoadImageInfo and compare its behavior with the autorotation-related code in ImageBuilder.PostDecodeStream; the report says this differs for portrait images from mobile phones. Reproduce the case on ImageResizer 4.2.8 and verify that source.width and source.height report the portrait orientation correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100