Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large GIFs are converted to JPEG when sending #5496

Closed
adbenitez opened this issue Apr 20, 2024 · 6 comments · Fixed by #5497
Closed

Large GIFs are converted to JPEG when sending #5496

adbenitez opened this issue Apr 20, 2024 · 6 comments · Fixed by #5497
Assignees
Labels
bug Something is not working

Comments

@adbenitez
Copy link
Member

when I drop a gift to the composer area, or even manually selecting it using the attachment button and then the "image" option, the gift is staged and I can see it is still an animated gif, but when I click the send button, the gif is converted to jpg in the outgoing message, selecting to attach as "file" sends the original gif without converting it, so I guess Desktop is converting images instead of leaving that to Delta Chat core!?

Specs:

Delta Chat Desktop	1.44.1 (git: v1.33.0-669-gc878fc787)
Delta Chat Core	v1.136.3
SQLite	3.39.4
electron	28.2.3
node	18.18.2

this is the gif file I tried:

tenor-3454536370

@adbenitez adbenitez added the bug Something is not working label Apr 20, 2024
@adbenitez adbenitez changed the title gif file converted to jpeg when the send button is pressed GIF file converted to jpeg when the send button is pressed Apr 20, 2024
@adbenitez adbenitez changed the title GIF file converted to jpeg when the send button is pressed GIF file converted to JPEG when the send button is pressed Apr 20, 2024
@iequidoo
Copy link
Collaborator

iequidoo commented Apr 22, 2024

For gifs Viewtype::Gif must be used by the app. Otherwise the core will convert the gif to jpeg if it's too big or contains Exif. There's no such problem on Android, a gif is sent as is if i use the "Gallery" attachment option

@Simon-Laux
Copy link
Member

so I guess Desktop is converting images instead of leaving that to Delta Chat core!?

no, it does not do such things, maybe it needs to detect gif and then set the view type to gif

@iequidoo
Copy link
Collaborator

no, it does not do such things, maybe it needs to detect gif and then set the view type to gif

Yes, that's what i tried to say :) But maybe we should move this detection to the core somehow? Not sure. CC @r10s

@Simon-Laux
Copy link
Member

maybe it makes sense to detect gif in core and send it as gif view type instead. or we could do it based on file ending/mimetype in desktop, I think this is possible/reasonable to do before the composer refactoring.

@r10s
Copy link
Member

r10s commented Apr 24, 2024

For gifs Viewtype::Gif must be used by the app. Otherwise the core will convert the gif to jpeg if it's too big or contains Exif

GIF cannot contain EXIF afaik.

so, maybe better try to send them always as is, independent of their size. in contrast to JPG and PNG they are not created by the user during normal usage of their devices, so if they're large, then it's that - similar to video or music files or stickers 1

iirc, the gist was always to let ui set Viewtype::Image or Viewtype::File that is then converted to Viewtype::Gif by core as needed.

see

if let Some((better_type, better_mime)) =
- guess_msgtype_from_suffix() converts to GIF - but the recent png-to-jpg conversions (which make totally sense and is a huge improvement, to be clear), are, maybe too greedy and converted GIF as well :)

There's no such problem on Android, a gif is sent as is if i use the "Gallery" attachment option

i was also wondering why android/ios do not have this but - and indeed, they check for the extension/mime-type and set GIF explicitly. still wondering how this is different from core setting "better type" using guess_msgtype_from_suffix(), this needs some research :)

i think, core should also add some explicit tests. we could then maybe also simplify android/ios code. i would change desktop code here only if fixing in core is too complicated or so

tl;dr: i think, it should be fixed in core

Footnotes

  1. there is also the question if Viewtype::Gif makes sense at all and if it cannot be just a sticker (probably yes :), however, for the issue at hand, i would not go for changes

@iequidoo iequidoo self-assigned this Apr 25, 2024
@iequidoo iequidoo transferred this issue from deltachat/deltachat-desktop Apr 25, 2024
@iequidoo
Copy link
Collaborator

Checked the code, this is actually a core bug introduced when implementing reencoding of large images, i.e. GIFs as well

@iequidoo iequidoo changed the title GIF file converted to JPEG when the send button is pressed Large GIFs are converted to JPEG when sending Apr 25, 2024
iequidoo added a commit that referenced this issue Apr 25, 2024
Otherwise, e.g. if a message is a large GIF, but its viewtype is set to `Image` by the app, this GIF
will be recoded to JPEG to reduce its size. GIFs and other special viewtypes must be always detected
and sent as is.
iequidoo added a commit that referenced this issue Apr 25, 2024
Otherwise, e.g. if a message is a large GIF, but its viewtype is set to `Image` by the app, this GIF
will be recoded to JPEG to reduce its size. GIFs and other special viewtypes must be always detected
and sent as is.
iequidoo added a commit that referenced this issue Apr 28, 2024
Otherwise, e.g. if a message is a large GIF, but its viewtype is set to `Image` by the app, this GIF
will be recoded to JPEG to reduce its size. GIFs and other special viewtypes must be always detected
and sent as is.
iequidoo added a commit that referenced this issue Apr 28, 2024
Otherwise, e.g. if a message is a large GIF, but its viewtype is set to `Image` by the app, this GIF
will be recoded to JPEG to reduce its size. GIFs and other special viewtypes must be always detected
and sent as is.
hagenest pushed a commit that referenced this issue Apr 30, 2024
Otherwise, e.g. if a message is a large GIF, but its viewtype is set to `Image` by the app, this GIF
will be recoded to JPEG to reduce its size. GIFs and other special viewtypes must be always detected
and sent as is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants