-
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
2366c1f
f2d9f02
7a54973
694fe6d
5e16aa6
d0771f6
4078173
e550201
82225ea
44824fe
961f9ed
0230fc8
19d9996
d491acc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# 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 image events indicating if | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To clarify, this field would be allowed in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess just images for now: clarified. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason not to allow it for stickers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not really sure to be honest, which is exactly why I'm leaving it for someone else to propose if they think it's appropriate. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that stickers are ~renamed images, I agree with Sumner that the same should apply to stickers. We don't have extensible events yet, but MSC3552 goes in the same direction about the images and stickers relation ship. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, let's do it for stickers too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid I am somewhat drowning with other commitments at the moment. If anyone would like to propose an update to this that would encompass stickers then please go ahead, otherwise I will put this on the back burner for a bit. |
||
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. | ||
|
||
## 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. |
Uh oh!
There was an error while loading. Please reload this page.