-
Notifications
You must be signed in to change notification settings - Fork 119
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
How to use ReadRGBAImageOriented with Exif Orientation? #95
Comments
Ok I found a partial solution: tiff.SetField(TiffTag.ORIENTATION, Orientation.TOPLEFT); //image orientation
tiff.ReadRGBAImageOriented(width, height, raster, Orientation.BOTLEFT) //requested orientation So I reset the image orientation tag to the default value before calling var originalOrientation = Orientation.TOPLEFT; //default
var value = tiff.GetField(TiffTag.ORIENTATION);
if (value != null)
originalOrientation = value[0].ToUShort(); //back up original orientation if exists
tiff.SetField(TiffTag.ORIENTATION, Orientation.TOPLEFT); //image orientation
tiff.ReadRGBAImageOriented(width, height, raster, Orientation.BOTLEFT) //requested orientation
//Now process originalOrientation here (flip/rotate raster) Further findings: The tile and strip get methods call libtiff.net/LibTiff/TiffRgbaImage.cs Lines 1256 to 1306 in 0de43f7
|
For example I read Orientation exif value from tiff file like this:
And for example if orientation value is RIGHTTOP and reading the image like this
The raster image is flipped vertically, but RIGHTTOP means rotate 90 degrees clockwise.
In you docs, I read that
orientation
parameter inReadRGBAImageOriented
method is "The raster origin position".So how do we map exif orientation value to this raster origin position?
I noticed you need to use BOTLEFT to get correct image when the exif value is TOPLEFT which I thought should be the default value for orientation. So we need to reverse every value? But by which logic?
I thought
ReadRGBAImageOriented
method was intended for easily getting an oriented frame.The text was updated successfully, but these errors were encountered: