#39 Photo Exif data is removed when image is rotated

Closed
opened 1 year ago by aheathershaw · 4 comments

I’ve recently discovered that the GD library removes Exif data from the image and replaces it with its own when an image is rotated and saved back out again.

Now we can “re-analyse” photos, we need the original Exif data available, so we shouldn’t be modifying the original image.

Instead, the thumbnail generation should be looking at the Orientation flag, and rotating the thumbnail, not the original.

I've recently discovered that the GD library removes Exif data from the image and replaces it with its own when an image is rotated and saved back out again. Now we can "re-analyse" photos, we need the original Exif data available, so we shouldn't be modifying the original image. Instead, the thumbnail generation should be looking at the Orientation flag, and rotating the thumbnail, not the original.
aheathershaw added this to the Version 2.1.0 milestone 1 year ago
aheathershaw self-assigned this 1 year ago
aheathershaw added the
bug
label 1 year ago
aheathershaw commented 1 year ago
Owner

This also means when manually rotating/flipping images, we can’t touch the original - only regenerate the thumbnails. When the original is viewed, we apply the transformations again stored in the database.

This also means when manually rotating/flipping images, we can't touch the original - only regenerate the thumbnails. When the original is viewed, we apply the transformations again stored in the database.
aheathershaw commented 1 year ago
Owner

After thinking this through a bit more, we now store the Exif data in MySQL (as of meta data V2) therefore as long as this data isn’t overwritten during a re-analyse, we just use that instead of going back to the original image.

This minimises the changes as the rest of BT’s behaviour can stay as it is now.

When an image is replaced, the stored Exif data must be removed and replaced with that from the new image.

After thinking this through a bit more, we now store the Exif data in MySQL (as of meta data V2) therefore as long as this data isn't overwritten during a re-analyse, we just use that instead of going back to the original image. This minimises the changes as the rest of BT's behaviour can stay as it is now. When an image is replaced, the stored Exif data must be removed and replaced with that from the new image.
aheathershaw commented 1 year ago
Owner

Any images that have been rotated (either manually or automatically using the Exif Orientation flag) must be re-uploaded using the new “replace image” function in 2.1 to restore the correct Exif data for future use/analysis.

Any images that have been rotated (either manually or automatically using the Exif Orientation flag) must be re-uploaded using the new "replace image" function in 2.1 to restore the correct Exif data for future use/analysis.
aheathershaw commented 1 year ago
Owner
Migrated from https://github.com/andysh-uk/blue-twilight/issues/39
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
Cancel
Save
There is no content yet.