-
Notifications
You must be signed in to change notification settings - Fork 401
MSC4230: Flag for animated images #4230
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
Open
dbkr
wants to merge
14
commits into
main
Choose a base branch
from
dbkr/animated-image-flag
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+80
−0
Open
Changes from 6 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2366c1f
Placeholder for animated image flag msc
dbkr f2d9f02
First draft
dbkr 7a54973
Get the prefixed flag right
dbkr 694fe6d
Use is_animated because that's what michael's impl uses
dbkr 5e16aa6
One day I will learn how to spell this word
dbkr d0771f6
Use specific image type
dbkr 4078173
Typo
dbkr e550201
Not a string
dbkr 82225ea
Typo
dbkr 44824fe
Hopefully clarify
dbkr 961f9ed
add that we can't tell it's animated
dbkr 0230fc8
use formal SHOULD
dbkr 19d9996
Fix missing words
dbkr d491acc
Clarify that browsers are awful
dbkr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# MSC4230: 'Animated' flag for images | ||
|
||
Since animated images are thumbnailed to a still image, clients need to download the full | ||
image in order to display it animated. However, there is currently no way of telling that | ||
an image is animated without downloading the original image. This means that clients wishing | ||
to display the image as animated must download the original image for any image format which | ||
is capabale of being animated. This means they download the full size image for non-animated | ||
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
images even when the user never chooses to enlarge the image. | ||
|
||
Even clients that animate images on hover must pre-fetch the full size image if they want the | ||
animation to start without a delay while it's downloaded. | ||
|
||
## Proposal | ||
|
||
We add an optional boolean flag, `ia_animated` to the `info` object of `m.image` events indicating if | ||
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
the image is animated or not. This SHOULD match whether the original image contains animation. Note | ||
that this will require clients probe the image file for animation. Simpler clients may, therefore, | ||
choose to not send this value at all, or always set it to false, meaning receiving clients are | ||
likely to render the image as non-animated. | ||
|
||
Example: | ||
|
||
```json5 | ||
{ | ||
"body": "partyparrot.gif", | ||
"file": { | ||
[...] | ||
}, | ||
"info": { | ||
"w": 640, | ||
"h": 480, | ||
"mimetype": "image/gif", | ||
"size": 35295, | ||
"is_animated": "true", | ||
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
``` | ||
|
||
If this flag is `false`, receiving clients can assume that the image is not animated. If `true`, they should | ||
assume that it is. | ||
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Behaviour when the field is omitted is left up to the client. They might choose to behave as if it is present | ||
and set to `true`, ensuring backwards compatibility whilst still saving bandwidth for images where the flag | ||
is present and set to `false`. Perhaps they might decide to change this behaviour once more clients start | ||
sending the flag. | ||
|
||
## Potential issues | ||
|
||
Clients may lie about the flag which would cause unexpected behaviour, for example, an image which | ||
was not presented might then animate when the user clicks to enlarge it, allowing for 'jump scares' | ||
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
or similar. Clients may wish to prevent images from being animated if the flag is set to false. | ||
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
As above, supporting animated images becomes harder for sending clients because they must work out if | ||
Half-Shot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
an image is animated in order to set the flag. | ||
|
||
## Alternatives | ||
|
||
We could specify that clients behave as if the flag is set to true if it's absent. This would mean | ||
clients that didn't want to probe images on upload could omit the flag, at the expense of receiving | ||
clients needing to download the original to probe for animation. | ||
|
||
We could require that servers, or clients in the case of encrypted rooms, preserve animation on | ||
thumbnailing. This is quite a burden for clients and would make thumbnails larger. | ||
|
||
This could also potentially be extended to `m.sticker` events. | ||
|
||
## Security considerations | ||
|
||
Potential for clients to lie about the flag and cause unexpected animation is covered in 'Potential | ||
Problems'. | ||
|
||
## Unstable prefix | ||
|
||
Until stable, the flag will be `org.matrix.msc4230.is_animated`. | ||
|
||
## Dependencies | ||
|
||
None. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.