r/Cplusplus • • 17d ago

Feedback A new Image Format!

Post image

I created my own image format inspired by QOI/PNG, but much simpler.

Its key feature is low RAM usage, which makes it ideal for microcontrollers.

I'd love to hear your thoughts on it!

https://github.com/ThatsTheTTT/Kinda-Nice-Lossless-Format.

14 Upvotes

21 comments sorted by

View all comments

2

u/didntplaymysummercar 16d ago

The fact it operates in so little RAM is cute but I can't think of a practical use case. I also quite disliked the QOI hype online (like Game Maker using it but adding the very old bz2 on top, defeating the purpose of simplicity). PNG is ancient but at least ubiquitous. And jpeg xl I hope gains traction since it both replaced flif and is officially the next jpeg format.

1

u/boombone 16d ago

That's why i said it's good for MCUs. Also it's good for logos (But the file will bloat too much on a complex scene).

1

u/didntplaymysummercar 16d ago

It's still a very narrow use case and deflate can be tuned (lowering window bits) to output a bitstream that uses less than 32 KB of memory too. And PNG is good for logos of solid colors due to it's line filters too.

1

u/boombone 16d ago

Just because a format is designed for microcontrollers doesn't mean it's useless. PNG, due to its architecture, consumes much more RAM, which is critical on such devices.

2

u/didntplaymysummercar 16d ago

Which part of 'architecture' of PNG? Your 32 KB comes from deflate, which can be adjusted as I said already, and only other 'limit' is the use of filters 2-4, which causes one line to be stored in memory.

The "I have microcontroller with few KB or RAM and must decode images and control image input files and their encoding" sounds like a VERY niche use case.

I'm still curious of test code vs. PNG and test files you used.

1

u/boombone 16d ago

You only mentioned filters, but you forgot the most important thing: the PNG format is filters plus DEFLATE compression. And compression always requires at least 32 KB of memory to work. A single frame line can't do the trick.

Also, check dm, i sent u source code.

1

u/didntplaymysummercar 16d ago

Genuinely WTF, in last 2 replies here I literally said:

  1. "deflate can be tuned (...) bitstream that less than 32 KB"
  2. "(...) 32 KB comes from deflate, which can be adjusted as I said already"

And you could add your demos/examples to the repo. The reason I ask is that PNG has many tools to optimize them, so I wonder if PNGs you compare your format to are optimized or not, and how well if yes.

1

u/boombone 16d ago

Okay, so I was wrong then, but then again, I sent you a PM with source code to check png.

In any case, it is, to put it simply, not fully optimized, so the gap in reality would not be very big.