Problem loading large animated GIF images [edited title]

Describe the issue:

Looks like there is a problem serving gif images. Assets URL says ā€œbackend errorā€. See the screenshot while trying to load this asset ā†’ https://www.datocms-assets.com/53444/1712829472-accessing-device-view.gif?auto=format&w=1024&dpr=4

None of GIF images is loading in my blog post.

(Optional) Can you provide a link to the item, model, or project in question?

N/A

(Optional) Do you have any sample code you can provide?

I am loading assets via datocmst React package and Image component. I donā€™t think itā€™s a problem in the image component, as the above URL doesnā€™t open directly as wellā€¦

hey @primoz.rome if you remove the auto=format it works.

I think in case of an animated GIF it makes sense to remove the parameter, what do you think?

Hmm, that is tricky, I can not dinamically asses on the GraphQL query level if image is gid then remove this parameter.

Plus, the animated gifs used to work, I am using this from the beginningā€¦ The question here is, why it should work with auto=format?

Thanks,
Primoz

Are you saying that these animated GIFs were working correctly and then stopped? With the same params?

I see your point and it makes sense to me, I was just checking if you could fix quickly your problem. Meanwhile Iā€™m going to contact Imgix as I think it should work with auto=format.

Yes, I am using same params in Blog Post page since April 2023, and gifs were working ā€¦ I have just now seen problems with them.

I am testing as we speak without auto=format, will keep you posted.

Just courious. Are GIFs working for you here: DewesoftX 2024.2 Released | Dewesoft ?

UPDATE: works fine on Windows OS (Chrome) and iPhone (Safari). Doesnā€™t work on my MacBook Air M2 - neither Safari or Chrome.

yes, it works here, I get this image: https://www.datocms-assets.com/53444/1712829472-accessing-device-view.gif?auto=format&w=1024&dpr=2 and works fine

Anyway Iā€™ll be in touch!

Another thing. Here on this page I also have image with same format=auto paramerter, and works nicelyā€¦

yes, looks like itā€™s a timeout problem on that specific file as itā€™s quite big, Iā€™ll keep you posted

1 Like

@mat_jack1 just for your reference, the mentioned GIF file (original file in assets) is not that big ā†’ 389.76KB. If it helps here is direct link to this asset inside DatoCMS.

@mat_jack1 It looks like a problem with animated WebP conversion, maybe?

https://www.datocms-assets.com/53444/1712829472-accessing-device-view.gif?fm=webp&w=1024&dpr=2 works fine. Changing dpr to 3 or higher causes it to time out: https://www.datocms-assets.com/53444/1712829472-accessing-device-view.gif?fm=webp&w=1024&dpr=4

Similarly, fm=auto&dpr=3 also works: https://www.datocms-assets.com/53444/1712829472-accessing-device-view.gif?fm=auto&dpr=3 but 4+ will crash it. Is this on our end or Imgix?

@primoz.rome, for these images, should they ever exceed dpr > 1 ? Youā€™re just enlarging them past their native size at that point, which causes pixelation or upsampling artifacts anyway. Might be better to export them at a higher native resolution and downsample to DPRs < 1 instead?

How can I control the dpr parameter? As far as I see dpr=4 is added automatically as I do not specifically add this to my GraphQL query:

... on ImageBlockRecord {
    id
    width
    image {
      responsiveImage(imgixParams: {auto: format, w: 1024}) {
         ...responsiveImageFragment
      }
    }
 }

Yes, the dpr is the way that we use to manage responsive images, so itā€™s automatically added.

A couple of ideas for you to try out:

  1. can you consider using w: 1280 ? The original GIF looks 1280px wide, this might be enough to prevent the dpr=4 to kick in.

  2. you can try using auto: format, compress, it might help reduce the size and avoid the timeout.

From Imgix they say that the problem is the rendering of the GIF with dpr=4 which makes a big image that times out. The compress can help and also avoid the dpr=4 to kick in. Let me know if these two options work for you.

@primoz.rome, if you add fit=max, like https://www.datocms-assets.com/53444/1712829472-accessing-device-view.gif?auto=format&dpr=4&fit=max, it should ensure the image is never upscaled past its native resolution (and in the process, help prevent DPR-related timeouts): Responsive Images with srcset | imgix Documentation (And sorry for not suggesting this earlierā€¦ I didnā€™t realize it was us adding the DPRs for you :person_facepalming:, my bad)

@mat_jack1 This almost seems like a bug on our part to me. I wonder if we should add that to our own image component/default Imgix queries too? DPR makes sense when an image is scaled down from its native size to fit a container, in which case DPR > 1 can improve clarity on retina devices. But when we accidentally use it to scale an image past beyond its native size, at best it will look bad (upscaled), at worst it will cause an Imgix timeout like here. Itā€™s what Imgix suggests in their responsive images tutorial too. I think Iā€™ve seen similar situations with other customers too, but at the time I didnā€™t realize we were the ones doing the DPR calculations for them. My mistake!

2 Likes

I have added this and it loads Gifā€™s nowā€¦

image {
   responsiveImage(imgixParams: {auto: format, w: 1024, fit: max}) {
      ...responsiveImageFragment
   }
}

Thanks @roger as always for great help!! Appreciated.

2 Likes