inb4 “it’s actually 14 kb 🤓” it’s the joy that is 1kb in size, here’s an image that’s 1kb:

  • Valmond@lemmy.world
    link
    fedilink
    arrow-up
    10
    ·
    21 hours ago

    I bet a hand crafted png can be smaller still, we used png for video games back in the day and there were some heavy tweaking bringing them down to close to nothing (removing all metadata, reducing the number of colors, …).

    Maybe they were bigger than 1kb, gotta dig up some examples…

    • MHLoppy@fedia.io
      link
      fedilink
      arrow-up
      6
      ·
      19 hours ago

      The maximum color quantization you can do on this image without huge information errors is something like:

      • 1x yellow-brown for stars / streamers / shorts / socks
      • 1x brown for tree base (though it might be better to remove the base to save a color)
      • 1x red for baubles / hat / sweater / shoes
      • 1x green for tree
      • 1x blue for hair (potentially you could merge the tree color if you want to really push it)
      • 1x skin tone for skin
      • 1x pink for mouth
      • 1x black for lines
      • 1x light yellow for background

      Which is 9 total colors. This would also require living with aliased text ( c r u n c h y ), since it would be data-expensive to add extra shades of gray. At that point you’re no longer making a low-quality copy of the original - you’d basically be making a pixel art version of it since you can’t afford any colors for anti-aliasing and gradients.

      Here’s an example PNG with 9 unique colors and some pretty simple patterns without huge information density: https://files.catbox.moe/bj0acl.png

      Even that’s 1,847 bytes! (i.e., basically 2KB)


      Edit: I made a big (in hindsight, obvious) mistake by forgetting I can literally just change the bit depth of the image when saving, so the example I’ve provided is actually very inefficient by comparison. Valmond has set me straight.

      • Hoimo@ani.social
        link
        fedilink
        arrow-up
        1
        ·
        9 hours ago

        Finally somewhere my knowledge of anime can improve the world! The character is Yotsuba and her hair is green, not blue, so one color for both the tree and her hair is absolutely fine!

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

        Nice!

        Did you use some specific soft to compress the png & get rid of the meta data? Because if you don’t then it will be way bigger.

        Also, you could anti alias the text with colours, that’s how it’s done on screens toaday, you just don’t see it from afar. And lastly, you could reduce the colorspace even more by reusing similarish colors.

        • Valmond@lemmy.world
          link
          fedilink
          arrow-up
          4
          ·
          10 hours ago

          I dug up some examples, I don’t have the talent needed to remake that, nor the executables for it but this is what people could compress back in the day:

          699 bytes:

          923 bytes:

          1.4kb:

          The same but smaller so 770 bytes:

          and some eye candy:

          2.3kb:

          2.1kb:

          10kb !

          So yeah, hard to push that original under 1kb I guess, but who knows ^^ !

          Merry Christmas !

          • MHLoppy@fedia.io
            link
            fedilink
            arrow-up
            1
            ·
            10 hours ago

            Shit, you’re absolutely right, I missed an (in hindsight very obvious) optimization - bit depth. It’s been so long since I’ve actually needed to worry about it that I forgot that the setting existed! What makes it even worse is that I did already play with quantizing the colors dwon to a more limited space, I just never baked that in as the bit depth haha.

        • MHLoppy@fedia.io
          link
          fedilink
          arrow-up
          1
          ·
          10 hours ago

          To be honest I’m not sure if the metadata actually matters much or not (I’ve never had to ultra-optimize like this before), but I just ran it through a PNG size optimizer and let it figure it out haha.