Replies: 1 comment
-
|
I don't know what readExifFromBytes is, so I can't comment on that. Since I don't know how your app is working with image files, I'll just give an example of working with an existing JPG file. For an existing JPG file, you can extract and inject EXIF data without decoding the image. So you could extract the EXIF data, set the Orientation value to what you want, and then inject the EXIF data back into the JPG. There's a test that does that, https://github.com/brendan-duncan/image/blob/main/test/formats/jpeg_test.dart. The code is final jpg = await File(pathToJpgFile).readAsBytes();
// Extract the EXIF data from the JPG, without decoding the JPG
final exif = decodeJpgExif(jpg);
// Set the Orientation value of the EXIF data.
// Here's some info on how the Orientation values work:
// https://jdhao.github.io/2019/07/31/image_rotation_exif_info
exif.imageIfd['Orientation'] = 4;
// inject the modified EXIF data into the JPG, which produces a new JPG
final jpg2 = injectJpgExif(jpg, exif)!;
// Write the JPG back out to file
File(pathToJpgFile)
..writeAsBytesSync(jpg2); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Greetings.
I am currently making an app in Flutter that saves a drawing that a user draws by hand.
In certain mobile phone models, the image drawn by the user rotates 180 degrees based on the x-axis, so I want to correct the image based on the orientation of the EXIF data.
I tried using the readExifFromBytes function, which the AI told me to use, but it outputs a message that this function does not exist.
Please give me a hint or reference code on how to solve this problem.
Beta Was this translation helpful? Give feedback.
All reactions