immich
immich copied to clipboard
Crop feature does not preserve "fileType"
The bug
I cropped the following image on the IOS app. (Note: File is a .png)
The edited image is below: (Note: Filetype is .jpg)
The editing operation does not retain the same filetype.
The OS that Immich Server is running on
Unraid
Version of Immich Server
v1.112.0
Version of Immich Mobile App
1.112.0 build 16.8
Platform with the issue
- [ ] Server
- [ ] Web
- [ ] Mobile
Your docker-compose.yml content
na
Your .env content
na
Reproduction steps
1. I am unable to reproduce this now because of another error with the crop feature: https://github.com/immich-app/immich/issues/11800
2. I had cropped this image prior to updating to v1.112.0. I was on v1.111.0 when this issue was present. But never did notice this bug until now
Relevant log output
No response
Additional information
No response
This is the expected behavior for the current crop tool. Thank you.
Just so that I am clear: Are you saying that any editing with save the image as a jpg. Meaning whatever the original format is, the edited one will be a jpg?
Just so that I am clear: Are you saying that any editing with save the image as a jpg. Meaning whatever the original format is, the edited one will be a jpg?
This is correct.
I do not think it work correctly. I used exiftool to look at the metadata of the image - at says it is a .PNG file. But the filename used by Immich is .jpg -> Something is definitely wrong.
exiftool -a -G -s _edited.jpg
[ExifTool] ExifToolVersion : 12.76
[File] FileName : _edited.jpg
[File] Directory : .
[File] FileSize : 296 kB
[File] FileModifyDate : 2024:08:29 12:40:50-04:00
[File] FileAccessDate : 2024:08:29 12:41:17-04:00
[File] FileInodeChangeDate : 2024:08:29 12:41:14-04:00
[File] FilePermissions : -rw-r--r--
[File] FileType : PNG
[File] FileTypeExtension : png
[File] MIMEType : image/png
[PNG] ImageWidth : 798
[PNG] ImageHeight : 449
[PNG] BitDepth : 16
[PNG] ColorType : RGB with Alpha
[PNG] Compression : Deflate/Inflate
[PNG] Filter : Adaptive
[PNG] Interlace : Noninterlaced
[PNG] SignificantBits : 16 16 16 16
[Composite] ImageSize : 798x449
[Composite] Megapixels : 0.358
When I try to edit the date of the image (or any metadata really) exiftool complains that it is not a jpg
Error: Not a valid JPG (looks more like a PNG) - _edited.jpg
0 image files updated
1 files weren't updated due to errors
Hello. Can this issue be reopened since it does not work as expected?
This is working as expected. There is work (and multiple issues/discussions) in making edits persist to the server. Uploading the edited file that you can download in the app back to the server was never how it's supposed to be used.
I do not understand the comment. I am not downloading and uploading anything. I just looked at the metadata of the edited file (both by downloading it from the webui AND directly looking at it on the server itself).
I think the issue you raise is valid (the edited image has incorrect metadata), but it's different from the topic of the issue. You can make a separate issue for that.
I am sorry. I am slightly confused because you say the file has incorrect metadata. Is the 'FileType' metadata field editable? Shouldnt we convert an image to another format or something? And are you suggesting that the new issue be focused towards having Immich write the correct metadata into that field?
My thought was, since the metadata says PNG, the extension should also be a .png -> And NOT, since the extension is .jpg, the metadata should be jpg
I am sorry. I am slightly confused because you say the file has incorrect metadata. Is the 'FileType' metadata field editable? Shouldnt we convert an image to another format or something? And are you suggesting that the new issue be focused towards having Immich write the correct metadata into that field?
My thought was, since the metadata says PNG, the extension should also be a .png -> And NOT, since the extension is .jpg, the metadata should be jpg
I think the part that's confusing here is that a file name (which can include an extension) is not metadata. I can name a file however I want and it'll still be the same file.
Yeah - I understand. created a new issue: https://github.com/immich-app/immich/issues/12880
I was under the impression that it actually is a JPEG file, but the metadata is from the original PNG file. On second thought, exiftool is probably right that this is a PNG and the filename is what needs to change. What I'm curious about is why the extension is .jpg then - don't we know what format we're writing the edited image as?
I was under the impression that it actually is a JPEG file, but the metadata is from the original PNG file. On second thought, exiftool is probably right that this is a PNG and the filename is what needs to change. What I'm curious about is why the extension is .jpg then - don't we know what format we're writing the edited image as?
I think it's honestly just hard-coded for whatever reason 😅. Don't ask me lol
Hello, sorry for the late reply. I have already commented on your new issue. But just to clarify, the current package that exports the image, exports the image in JPG no matter what. And yes, I still haven't fixed the rewriting of the metadata onto the new image 😅therefore none of the metadata is copied so I presume that is why you see a different format in metadata. I see there is another issue on this, so therefore concluding this issue. Thanks for the issue! More info here: #12880