is it a formatting step that an image goes through when uploaded? I’m tired of converting image after image back into jpg, so if there’s like a step I can take to avoid it being a webp, it would help to know

  • JohnDClay@sh.itjust.works
    link
    fedilink
    arrow-up
    19
    arrow-down
    2
    ·
    9 months ago

    Isn’t jpg more efficient for pictures, whereas png is better for graphics type elements with defined colors and edges?

    • Chronographs@lemmy.zip
      link
      fedilink
      English
      arrow-up
      42
      ·
      9 months ago

      Jpg is lossy and throws away information every time it is used, that’s why you get the “deep fried effect” when you re-encode something repeatedly. PNG is lossless so it’s a perfect replica of whatever image you encode with it. It does take up more space however.

      • LillyPip@lemmy.ca
        link
        fedilink
        arrow-up
        17
        arrow-down
        2
        ·
        edit-2
        9 months ago

        Minor niggle: the ‘deep fried effect’ isn’t because jpg throws away information every time, it’s because the compression algorithm averages pixel boundaries, and that averaging multiplies with each compression pass.

        It can actually bloat the size of the file by adding information – adding data to previously null pixels, whereas png would keep them clean.

        e: it achieves this through pixel averaging (fuzzing), which is why you’ll see grey artefacts bleeding into the pixels around line art. This is magnified with each compression.

        • Slotos@feddit.nl
          link
          fedilink
          arrow-up
          18
          ·
          9 months ago

          You’re conflating “data” with “information”.

          Repeated re-encoding loses information. “The compression algorithm averages pixel boundaries” is a perfect example of losing information.
          That it sometimes results in more bits of data is a separate phenomenon altogether.

      • uis@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        9 months ago

        There is lossless JPEG, but nobody uses it. And there are lossy PNG encoders, and some people use them.

    • Granixo@feddit.cl
      link
      fedilink
      arrow-up
      37
      arrow-down
      2
      ·
      edit-2
      9 months ago

      JPEG is for real life photos and document scans, using it for anything else is just lossy compression.

    • Max-P@lemmy.max-p.me
      link
      fedilink
      arrow-up
      29
      arrow-down
      1
      ·
      9 months ago

      whereas png is better for graphics type elements with defined colors and edges?

      The reason for that is rather surprising, but PNGs are basically zipped BMPs with an optional filter step to arrange the pixels in a way that compresses better.

      And that’s why if you give it a photo with lots of details, it’s not very effective and just gives you a rather big file. PNG barely does anything compared to JPEG and other formats. That’s also why it’s great for small things like icons: it decompresses fast and still manages a fairly good compression ratio when a good chunk of the image is transparent or flat background.

    • dyc3@lemmy.world
      link
      fedilink
      arrow-up
      15
      ·
      9 months ago

      Jpg is better for photographs. Png is better when there are a lot of homogeneous pixels, like cartoons or rasterized vector graphics.

    • amio@kbin.social
      link
      fedilink
      arrow-up
      9
      ·
      9 months ago

      PNG is lossless and JPEG is not. JPEG is about a sliding scale of “quality” (at the cost of file size) and minimizing how much it fucks with the visual end result.

      • uis@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        9 months ago

        PNG can be lossy and JPEG can be lossless, but nobody use them this way.

        • amio@kbin.social
          link
          fedilink
          arrow-up
          2
          ·
          9 months ago

          This comment was basically inevitable. Broad strokes for what the vast majority of cases will be, is my defense :p

    • eerongal@ttrpg.network
      link
      fedilink
      arrow-up
      8
      ·
      9 months ago

      Jpg is really bad for anything with sharp lines, such as text. It also doesn’t support alpha channel (transparency) which is reasonably important in modern web design.

      PNG is loseless, which is great for… anything other than storage/bandwidth due to file size. There’s even an animated PNG standard, similar to animated GIF, but you never see that used anywhere.

    • LillyPip@lemmy.ca
      link
      fedilink
      arrow-up
      4
      ·
      9 months ago

      (I accidentally responded to the wrong comment before.)

      Yes, that’s exactly right.