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

The attached GIF is transformed into a static image #2785

Open
softvision-sergiulogigan opened this issue Jan 29, 2019 · 11 comments
Open

The attached GIF is transformed into a static image #2785

softvision-sergiulogigan opened this issue Jan 29, 2019 · 11 comments
Assignees

Comments

@softvision-sergiulogigan
Copy link
Collaborator

Browser / Version
Chrome 71

Operating System
Windows 10

Prerequisites:

  • Login to webcompat.com

Steps to reproduce:

  1. Navigate to: https://webcompat.com/issues/new
  2. Report an issue with an attached GIF.
  3. Observe the GIF rendering.

Expected Behavior:
The gif is animated.

Actual Behavior:
The gif is static.

Notes:

  1. See www.dailymotion.com - The video scrolls out of view web-bugs#25033

Watchers:
@softvision-oana-arbuzov
@softvision-sergiulogigan
@cipriansv

sv;

@softvision-sergiulogigan
Copy link
Collaborator Author

Might be related to #2719

@karlcow
Copy link
Member

karlcow commented Jan 31, 2019

Maybe not the same issue. GIF and Pillow are not good friends and I guess this is the issue from #2719

but here you seem to get a static GIF like if the original image had been converted to a simple GIF.
The original GIF you were trying to post is massive.
7,054.19 KB (7,223,486 bytes)

And I guess then it is being reduced by… @miketaylr client side script (as we have 4MB limit for the form), in the process, it destroys the animated gif and make it just a simple gif.

@karlcow
Copy link
Member

karlcow commented Jan 31, 2019

I will assign this one to @miketaylr and I will take the other one.

@miketaylr
Copy link
Member

A 7MB GIF is too big, I would say this is probably expected behavior given its size. I wonder if there's something we could do with UX here to at least communicate the implications for a large GIF.

@marimeireles
Copy link
Member

@miketaylr what do you think of adding an ìf` here:

success: _.bind(function(response) {
this.addImageUploadComment(response);
this._loadingIndicator.removeClass("is-active");
}, this),

if e.target.files[0].size > 7MB
prints message to user warning that it may fail

@marimeireles
Copy link
Member

I mean:

if image type == GIF && if e.target.files[0].size > 7MB

@miketaylr
Copy link
Member

I think that's probably the wrong place to check that, @marimeireles.

In BugForm#showUploadPreview, we downsample it if it's bigger than the upload limit -- so I think it would never hit that if statement inside ImageUploadView#validateAndUpload.

this.showUploadPreview = function(dataURI) {
// The final size of Base64-encoded binary data is ~equal to
// 1.37 times the original data size + 814 bytes (for headers).
// so, bytes = (encoded_string.length - 814) / 1.37)
// see https://en.wikipedia.org/wiki/Base64#MIME
if (String(dataURI).length - 814 / 1.37 > this.UPLOAD_LIMIT) {
this.downsampleImage(
dataURI,
_.bind(function(downsampledData) {
// Recurse until it's small enough for us to upload.
this.showUploadPreview(downsampledData);
}, this)
);
} else {
this.makeValid("image");
this.addPreviewBackground(dataURI);
}
};
,

So if we want to not attempt to resize (animated?) GIFs, that's probably the place to do it. It would be interesting to see how to detect animated GIFs from JS...

@marimeireles
Copy link
Member

marimeireles commented Apr 29, 2019

Apparently there are a few different weird ways to do that. Using a npm package, checking the gif headers and converting it to an array.
I could also just print a message to the user explaining that we will down sample the image and it will stop being animated, if you think these solutions are overkill... @miketaylr

@softvision-raul-bucata
Copy link
Collaborator

It was observed that when a reporter fills in the bug report form with valid data until the "Screenshot" section of the report is reached when the reporter uploads a file in .gif format, the file is actually uploaded in a .jpeg format and can not be viewed in its original format. This is reproducible in the staging version and in the public version.

Notes:

1.When the reporter tries to edit a report, this is the result in the screenshot section:

Screenshot_38

  1. Public version: https://webcompat.com/issues/new
    Staging version: https://staging.webcompat.com/new
  2. Reproducible across all browsers.

Environment:
Operating system: Windows 10 Pro x64
Browser: Firefox Nightly 87.0a1 (2021-01-26) (64-bit) / Google Chrome Version 87.0.4280.141 (Official Build) (64-bit)

@karlcow
Copy link
Member

karlcow commented Jan 26, 2021

@softvision-raul-bucata The conversion from gif to jpeg is on purpose to save space. :) It should not happened for animated GIF. which is what this issue is about. Was it an animated gif you were trying to upload?

@softvision-raul-bucata
Copy link
Collaborator

@karlcow it is an animated GIF. It has 145 frames and takes 3.43 MB in storage space.

gif for testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants