Skip to content

Commit

Permalink
TIFFも読込時にEXIFを向き以外破棄する
Browse files Browse the repository at this point in the history
  • Loading branch information
4ster1sk committed Nov 14, 2024
1 parent f5335c4 commit 6451c97
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,19 @@ class NoteCreateNotifier extends _$NoteCreateNotifier {
);

case "image/tiff":
final f = decodeTiff(imageBytes);
final tiff = decodeTiff(imageBytes);
if (tiff == null) {
throw const FormatException("Decoded TIFF image is null");
}

final exif = ExifData();
if (tiff.exif.imageIfd.hasOrientation) {
exif.imageIfd.orientation = tiff.exif.imageIfd.orientation;
}
tiff.exif = exif;

return ImageFile(
fileName: "$basename.jpg",
data: (f != null) ? encodeJpg(f, quality: 95) : Uint8List(0),
);
fileName: "$basename.jpg", data: encodeJpg(tiff, quality: 95));

default:
return ImageFile(fileName: basename, data: imageBytes);
Expand Down

0 comments on commit 6451c97

Please sign in to comment.