Stefan Oltmann
11/03/2023, 1:46 PMImage.makeFromEncoded(myImageBytes)
uses the EXIF orientation to correctly rotate the image, which is all fine and well.
In the case of my application I want an option to load it without orientation or to provide a custom one.
The file might be accompanied with a sidecar XMP where the user specified another orientation than what was written into the file.
I would be helpful if SKIA at least would have a flag what orientation the loaded image has. Now I would need to parse the file myself to find out.Kirill Grouchnikov
11/03/2023, 1:53 PMStefan Oltmann
11/03/2023, 1:54 PMKirill Grouchnikov
11/03/2023, 1:58 PMStefan Oltmann
11/03/2023, 1:59 PMStefan Oltmann
11/03/2023, 3:10 PMImage.makeFromEncoded(myImageBytes)
😅Stefan Oltmann
11/03/2023, 3:15 PMval xmpOrientation: TiffOrientation = TiffOrientation.MIRROR_VERTICAL // TODO: load from XMP
if (xmpOrientation != null) {
val orientationOffset =
JpegOrientationOffsetFinder.findOrientationOffset(ByteArrayByteReader(bytesToUse))
if (orientationOffset != null) {
bytesToUse[orientationOffset.toInt()] = xmpOrientation.value.toByte()
} else {
val updatedBytes =
Kim.update(bytesToUse, setOf(MetadataUpdate.Orientation(xmpOrientation)))
bytesToUse = updatedBytes
}
}
Stefan Oltmann
11/06/2023, 1:13 PM