• Olissipo@programming.dev
    link
    fedilink
    arrow-up
    58
    arrow-down
    2
    ·
    edit-2
    13 hours ago

    I’m working on a project which generates images in multiples sizes, and also converts to WEBP and AVIF.

    The difference in file size is significant. It might not matter to you, but it matters to a lot of people.

    Here’s an example (the filename is the width):

    Also, using the <picture></picture> element, if the users’ browsers don’t support (or block) AVIF/WEBP, the original format is used. No harm in using them.

    (I know this is a meme post, but some people are taking it seriously)

    • TwistyLex@discuss.tchncs.de
      link
      fedilink
      arrow-up
      3
      ·
      6 hours ago

      Literally just today solved a problem of delivering analytics plots over our internal chat system. The file size limit is 28Kb and I was just getting ready to say screw it, can’t be done.

      Lo and behold our chat system that doesn’t support svg does support webp. Even visually complicated charts come in just below the size limit with webp.

        • TwistyLex@discuss.tchncs.de
          link
          fedilink
          arrow-up
          3
          ·
          5 hours ago

          Honestly no idea. It’s funny though. The API allows us to either read it directly from our lakehouse with the 28Kb limit, or allows us to encode it in a json object. It actually recommends using the json method if we want to send larger files… but then complains it’s too large if it’s over 28Kb 🤷‍♂️

          I think it was probably originally only intended to allow attaching icons.

          • bamboo@lemmy.blahaj.zone
            link
            fedilink
            English
            arrow-up
            1
            ·
            5 hours ago

            Feels like a bug where someone forgot the 1 in 128kb. What chat app is this?? In Slack, custom emojis can be up to 128kb in filesize

            • TwistyLex@discuss.tchncs.de
              link
              fedilink
              arrow-up
              2
              ·
              5 hours ago

              It’s MS Teams with their PowerAutomate flows from Fabric. The limitation might not exist in the direct rest API, which I could have used through Python; but it’s a hackathon, and my other team mates know PowerAutomate. Faster if we each coordinate using what we’re good with.

    • HeyListenWatchOut@lemmy.world
      link
      fedilink
      English
      arrow-up
      15
      ·
      10 hours ago

      I’ve mentioned this topic in regards to animated images, but don’t see as big a reason to push for static formats due to the overall relatively limited benefits other than wider gamut and marginally smaller file size (percentage wise they are significant, but 2KB vs 200KB is paltry on even a terrible connection in the 2000s).

      What I really wish is that we could get more browsers, sites, and apps to universally support more modern formats to replace the overly bloated terribly performing and never correctly pronounced animated formats like GIF with something else like AVIF, webm, webp (this was a roughly ~60MB GIF, and becomes a 1MB WEBP with better performance), or even something like APNG…

      Besides wider gamut, and better performance, the sizes are actually significant on all but the fastest connections and save sites on both storage and bandwidth at significant scale compared to the mere KB of change that a static modern asset has.

      This WEBP is only 800KB but only shows up on some server instances since not every Lemmy host supports embedding them :

      • Olissipo@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        9 hours ago

        but 2KB vs 200KB is paltry on even a terrible connection in the 2000s).

        You still need to resize the images and choose the right ones (even if only for the device’s performance).

        So we might as well do that small extra step and add conversion to the process.

        What I really wish is that we could get more browsers, sites, and apps to universally support more modern formats to replace the overly bloated terribly performing and never correctly pronounced animated formats like GIF with something else like AVIF, webm, webp (this was a roughly ~60MB GIF, and becomes a 1MB WEBP with better performance), or even something like APNG…

        Isn’t that the users’ fault? And of the websites for allowing those huge GIFs.

        Apparently browsers have supported MP4 for a long time.

        https://caniuse.com/mpeg4

      • AdrianTheFrog@lemmy.world
        link
        fedilink
        English
        arrow-up
        7
        ·
        edit-2
        11 hours ago

        Webp is supported in browsers. Jxl is not, unfortunately.

        (Well, I have the Firefox extension for it, but most people can’t see them…)

        People should still use it tho, with the fallback of webp or avif

        • ILikeBoobies@lemmy.ca
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          7 hours ago

          Firefox just hasn’t enabled the setting (well they haven’t made the setting enable jxl support yet even though the setting and support has been there for years). This means their forks support it, that’s why I switched to Waterfox

          Safari supports it

          Chromium removed support for it 2 years ago to push webp but it’s just a reminder to not use Chromium browsers

    • TrickDacy@lemmy.world
      link
      fedilink
      arrow-up
      6
      arrow-down
      1
      ·
      11 hours ago

      I’m mad tho! I have technical issues with a format that works for hundreds of millions of users daily with the only impact being their website loads faster! RAGE!

    • Thorry84@feddit.nl
      link
      fedilink
      arrow-up
      2
      ·
      10 hours ago

      How is the size difference after gzip compression? Probably pretty much the same, but I wonder how large the difference is then. Since a lot of folk make sure the contents is gzipped when served to the user.

      • Olissipo@programming.dev
        link
        fedilink
        arrow-up
        6
        ·
        9 hours ago

        Even using the highest compression levels, barely any difference. Not worth it

        If I understand correctly gzip, brotli and similar are best used to compress text.

        Font files also shouldn’t be compressed. A TTF file compresses a bit, but a WOFF2 file will be even smaller than that (and WOFF2 also doesn’t compress well). So might as well use WOFF/WOFF2

        • vvvvv@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          5 hours ago

          If I understand correctly gzip, brotli and similar are best used to compress text.

          Compression algos should be used on uncompressed data. Using them on already compressed data (most video, images, music formats) is generally useless.

    • Valmond@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      12 hours ago

      Is the quality the same? If so how do you know? I mean it’s better, I’m just curious.

    • Fabian@lemmy.zip
      link
      fedilink
      arrow-up
      1
      ·
      12 hours ago

      I don’t know if the client is the issue, but I am using the Voyager android app and this image failed to load