2 ms·
My favourite part of TIFF is what they do about y-ordering. See, sometimes people think images start at the top, so the first data at y=0 is at the top of the
by tialaramex 2y ago
My favourite part of TIFF is what they do about y-ordering.
See, sometimes people think images start at the top, so the first data at y=0 is at the top of the image, other people think they start at the bottom like a graph you draw in maths, were y=0 is clearly at the bottom of the image.
So TIFF says: That should be a parameter of the image.
Why? Well, TIFF came into existence because of scanners, when scanners were first invented each scanner would have its own data format - you're not going to store all this data because that's expensive - who owns that much tape? But when it's scanned clearly the bits you get have some sort of arrangement, maybe a bright white area is 1 and black is 0, maybe the opposite. That's kind of annoying, lets agree a standard.
OK, so as Scanner Maker A my proposed standard is: Exactly what my popular A9 Scanner does
No! As scanner maker B, clearly the standard should be what our BZ-20 model does
No! Everybody at scanner maker C knows the obvious thing to do is derive the standard from the behaviour of our popular C5 and C10 scanners!
Result: The TIFF standard says all of the above are OK, just add header data explaining what's going on. Since some scanners would scan a page from the top, those say y=0 is at the top, those vendors whose scanner works the other way say y=0 is at the bottom!
- nayuki 2y ago> My favourite part of TIFF is what they do about y-ordering. Windows BMP (DIB) also has the convention that y=0 is at the bottom. https://en.wikipedia.org/wiki/BMP_file_format https://en.wikipedia.org/wiki/BMP_file_format
- tialaramex 2y agoRight, it's fine if your image format has an opinion about this, what's infuriating is that TIFF lets each individual image have its own opinion, so a decent TIFF decoder needs to be able to do either for each image.
- ChrisMarshallNY 2y agoApple's QuickDraw GX did that, as well (I believe -it's been a long time). I think it was because it was based on display Postscript. What a huge PItA.
- astrange 2y agoFlipping the image sometimes doesn't sound that bad. IIRC it's common for JPEGs to have rotation metadata, because sometimes you want to rotate or flip a camera image and you don't want to recompress it when you do.