I’m jumping in the midst of this quality conversation, but just wanted to add (after Bunny explained how text files are actually “text”, because that’s really required) that PNG format has a long history of being VERY complicated, internally, unlike TIFF which is effectively VERY simple, by contrast.
Comparing the two directly is very unhealthy. That’s my first point, and I’ll explain why shortly.
My second point is that it’s important to understand the difference between raw, lossy and lossless.
Raw image is what the hardware is hungry for. You stream that bitch, you get its contents on the screen. Typically what we call as bitmaps (not the BMP format per se, that’s Windows Bitmap) are very near to what you actually want, plus minus some rearranging, reordering, flipping axes, and whatnot. You do almost nothing special to prepare such a stream, and voila, there’s a show on your screen or your printer. But there is a problem, raw data is HUGE! Even for today standards.
Lossless compression works like a zip, it packs HUGE data to much less data, via magic and interdimensional portals, and you can get your information back in a pristine condition, but you have to trade some CPU time (and memory) to push stuff through these portals.
Lossy compression is even better. It uses smoke and tricks to fool the brain into seeing one thing, by taking advantage of our limited perception, thus it can crunch raw data even further, but the price you pay is that some information has been permanently lost.
Ideally, why use raw other than for speed, when you can use lossless if you can cope with the coder/decoder performance (aka codec). Lossy is only really good for dumb memes, who cares about that right, let’s conserve some bandwidth instead.
Both PNG and TIFF are lossless formats, by their design and intention, and given their purpose, you’ll see why PNG is much more complicated than TIFF.
PNG was intended as a replacement for GIF, historically, and because it was intended for the internet, it employs some heavy duty compression that verges on astrophysics (not literally) established from doctoral papers on computer graphics. Sadly it turns out it doesn’t really do its job, not in terms of compression (that part is brilliant), but in terms of decoding performance. GIF was legally in a limbo for the time, being patented (and the patent changed hands), and it was also obsoleted because the hardware became more powerful, so the authors of PNG were pushed to make something that is universally acceptable on the internet, and for this they pursued a masterpiece in lossless compression.
In the end PNG (portable network graphics) format lost to JPEG (joint photographic experts group), which is a lossy compression, but it became so ubiquitous that it seriously destroyed every image it ever encoded. It took us some time to recover from the early internet, and to get better processing power until PNG became as regular as it is nowadays.
TIFF was historically designed to be very portable and not so much compressed. It’s an archival format intended for professional usage in desktop publishing and printing industry by Aldus that was later gobbled up by Adobe. The idea behind it was not the internet, but the actual raw storage, so it supported various color spaces from the get go, and is designed to streamline the color separations as independent bitmaps. But because space was a problem back then (and printing quality demands HUGE data), they’ve decided to go with a plug-in based model for compressing images in the codec directly. So the format was designed in such a way to encourage 3rd party meddling with all kinds of encoders and compression algorithms, of which only two had actually won. One is LZW, or Lempel-Ziv-Welch image compression algorithm (though there are numerous algorithms in this family, these guys were very productive together and on their own), the other is “plain” ZIP. It turns out LZW works slightly faster with CMYK separations (specifically at or beyond 300 dpi), but the differences in compression itself are negligible. Anyway this explains why TIFF (tagged image file format) has much better internal specs of the header and the way it’s laid out, and it even contains some human-readable data.
For the end, I wanted just to share this almost-documentary by Reducible (an excellent YT channel if you’re into computer engineering) on how exactly PNG works internally, where also another file format is shown near the end, called QOI (quite ok image) discovered only recently by some random guy, who managed to pull off only slightly worse compression than PNG’s (on a stochastic 32-bit image database in a direct one-to-one comparison) however the codec itself is trivially simple and turns out to possess an incredible performance rating. By contrast, none of the formats mentioned so far were made by some random guy, but by big consortiums and academia, so there is obviously a lot of room for improvement.
There you go, if you really want to learn more about this stuff, I’ve been doing what you’re doing in the early 90’s, so all of this might be useful to you.