How hard would it be to display the contents of an image file on the screen?
wolf.nereid.pl
wolf.nereid.pl
1: Image viewer [libraries] have silly bugs
a. no one knows what they're doing?
2. Copy and paste code to get images on the screen a. not very accurately
b. very slowly
3. I want to understand everything a. here's sRGB, here's Y'UV
b. here's tone mapping
c. etc
the prose and overarching methodology reminds me of frinklang's data file[0] (https://frinklang.org/frinkdata/units.txt) which is... hilariously and educationally opinionated about ... units and measurements and conversions.the writing style comports with how i approach problems and may not jive with other methodologies, maybe? If i have some problem i generally will try copying and pasting (or copilot.exe or whatever) just to see if the problem space has any state of art. If that does what i want, great. I'm done. if i need to do what i want 10,000 times, i usually will dig in and speed it up, or add features (event handling, etc)
I also like scathing commentary about annoyances in technology, and this article had that, for sure. the webp aside was biting!
[0] huh, this file has been updated massively since i last viewed it (mid 2010s) - it looks like earth has made some advancements in definitions of primatives - like Ampere - and things might be more exact, now. Hooray!
It's used by the US National Map, the National Geospatial Intelligence Agency, CAT scanners, and Second Life. JPEG 2000 lets you zoom in and access higher levels of detail without reading the whole file. Or not zoom in and read a low-rez version from a small part of the file. So it's good for map data.
Deep zooming doesn't come up much in web usage, and browsers don't support JPEG 2000.
The JPEG 2000 decoder situation isn't good. OpenJPEG is slow and has had several reported vulnerabilities. There are better expensive decoders, and GPUs can be used to help with decoding, but the most popular decoders are slow.
[1] https://ds.jpeg.org/whitepapers/jpeg-htj2k-whitepaper.pdf
> I was able to find a reasonable amount of AVIF HDR images, but HEIC HDR is nowhere to be found.
Anything taken by an iPhone camera is an HDR HEIF image… sort of. For backwards compatibility reasons it's an SDR image with an additional attached image called a gain map that HDRifies it. (This is mathematically worse for a reason I don't remember; it causes any picture taken at a concert with blacklights or blue spotlights to look bad. Once you see this you'll never unsee it.)
I believe the very newest Sony cameras can also save HEIF images, however I don't feel like spending $2500 to upgrade my second-to-newest A7 to a newest A7 to find out.
Lightroom also recently added HDR editing so maybe it can export them now?
The iPhone camera sensor is prone to saturating and clipping the blue channel when strong light from a blue LED is in the frame. Once the blue channel clips at the maximum value, a typical HDR gain map won't do anything to restore more nuance to it because they're not designed to add high-frequency detail to a blob of clipped pixels with identical values in the base image.
- JPEG with HDR gain map is not supported
- AVIF and JXL HDR files look fine on initial export, but do not survive being sent anywhere from the Photo Library.
So far I haven’t found a way to export an HDR file from Lightroom and then share it with anyone, iOS or Android.
Seriously, make something new that works either with ssh or wireguatd and cement your name in fame.
To make things worse, tools get much better they get once you start thinking hard about re-implementing things. It seems it takes a lot of hatred to start such a project, and starting is the easy part as it only needs the first 80% of the effort.
- HTTP management interfaces
- RPCs such as what’s used in the Microsoft Windows ecosystem
- Agent-based configuration management / IaC tools such as Puppet
Each has their own strengths and weaknesses. But for all the criticisms people make about the terminal, and many of the complaints are completely justified, it’s often those weird eccentricities that also make the terminal such a powerful interface.
1. Prints a bunch of blank lines corresponding to the height of the image
2. Renders the image/video using the fbdev in the space provided.
3. Scrolling the terminal whilst viewing is handled by moving/cropping the fbdev-rendered media as appropriate?
Fun stuff. BTDT. Got the T-shirt.
[0] https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pd...
(And don’t take this as a knock against TIFF in general—as far as I know, it’s one of the few image formats that takes the possibility of large and larger-than-memory images seriously. I think HEIF also does? But ISO paywalled it after first making it publicly available, so, hard pass.)
[1] Here’s a writeup that comes to similar conclusions: https://dpb587.me/entries/tiff-ifd-and-subifd-20240226
It was in C++, and I couldn’t do 100%, but I probably got about 80% (but not so performant). The weirdest thing, if I remember correctly, was pixel data with different sizes between stored components.
Traditional readers saw a JPEG (although an unusually obese one), but our software could access the second entry, which contained the raw source, and the control parameters for all the processing steps that resulted in the JPEG, so we could treat the image as nondestructive, and reversible.
It was never actually released, if I remember, but it may well be patented.
TIFF was originally designed to store drum scanner data, in realtime, so it uses strips, as opposed to tiles.
I wonder if grandparent meant something else, but i don't know enough this instant to guess at what other format?
The real kicker is it's not even useful. Just say "unsupported" to everything that isn't a dumb RGB dump and no one will ever notice!
I don't think I ever saw a embedded jpeg.
The writer was so trivial that even with the need to encapsulate the uncompressed data in a Deflate compatible bitstream it was just easier than trying to do a BMP output.
I've even released my code under public domain if someone is interested: http://public-domain.advel.cz/
Like, DNG files are TIFFs, so now you need a raw camera decoder, which is basically subjective.
I was young and stupid, back then.
I learned about not biting off more than I could chew. Important lesson in humility.
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!
Windows BMP (DIB) also has the convention that y=0 is at the bottom. https://en.wikipedia.org/wiki/BMP_file_format
What a huge PItA.
It's fairly "low-level," so could probably benefit from Façades.
The newer formats achieve better compression by adding more and more stuff. They're year-long projects to reimplement, which makes almost everyone stick to their reference implementations.
Even most Windows programs (including Windows Explorer thumbnails) don't display images correctly, which is infuriating.
You can't just handle pixels, you need to handle pixels in a context of input and output profiles. That's a pain like code-page based text encodings before Unicode, and we haven't established a Unicode equivalent for pixels yet.
The problem colour profiles solves is about how the monitor should display those colours. It’s so that what you see on the screen is going to be exactly the same shade of CMYK as what gets printed.
It’s a big problem for magazine (and equivalent) publishing. Movies too. But much less of an issue for other media industries which are targeting end user devices like smart phones and laptops.
The equivalent in typefaces would be the font rasterisation itself (like Microsoft Clear Type) rather than code pages.
You need a monitor profile because the display protocol takes dumb numeric values that are interpreted in monitor-specific way, instead of being sent in some universal color space, and converted to monitor's internal format by the monitor itself.
In this analogy monitors are like pre-Unicode printers, where characters were just bytes, and the bytes mapped to whatever 8-bit language-specific font the printer had.
This isn’t true. Particularly with monitors where people can adjust the contract and brightness.
The reason colour profiles exist is so that computers can be calibrated to support the monitor output.
You are also ignoring the fact that environmental factors can have an effect too. Ie how the room is lit.
Comparing something standardised like writing glyphs with something highly individual (monitor calibration) doesn’t make a whole lot of sense.
It may be worth nothing that Chafa can be configured to only use ASCII 219
Another nice thing about it is the author made an ffmpeg patch (playable using -c:v rawvideo -pix_fmt rgba -f chafa) that was pretty darn handy for quickly triaging videos on a remote server without having to relay them to a more usable terminal.
And it has sixel support too if you happen to be in a terminal that supports that.
And since he's delegating to imagemagick, it has loaded every image format I've thrown at it, including RAW.
And if you're doing text with images, integrating both Sixel and Kitty is especially painful because they have completely different display models.
(In particular, Sixel is cell based, so you get Z-ordering for free - with the caveat that writing text on top of images destroys the cells.
Meanwhile, Kitty has Z-ordering, but it's per-image, so e.g. to draw a menu on top of an image that partially covers text, you must send a new image with space for the menu erased...)
For those who are interested, the best resource I've found on this is the notcurses author's wiki: https://nick-black.com/dankwiki/index.php/Theory_and_Practic...
Maybe the first quantized picture credit should go to Roman mosaics which quality wise are about the same as a lo-res JPEG.
Now, if you do right click, save image, it should then make another request with a different header that says webp, AVIF or whatever is not accepted, for the original JPG in high resolution with minimal compression to be downloaded.
scat () {
if [ "" != "$1" ]
then
COLS=`tput cols`
if [ "$COLS" -gt "96" ] ; then COLS=96 ; fi
convert "$1" -resize $(( $COLS * 9))x^200 -background white -flatten sixel:-
fi
}Well, it's not like PNG and SVG are any different.
This is totally different from a container which can contain any type of data in any type of format. If you get a valid PNG, you can load something meaningful from it. If you get a generic container, you might be able to inspect it at a surface level but there's no guarantee that the contents are even conceptually meaningful to you.
It’s a bit like criticizing a format for being XML-based, under the argument that XML can represent all kinds of payloads.
For generic containers, there are no expectations on what's inside. If I'm making a video player, do I support MKV? Well, some of them. Not all of them. You have to try it and find out. Heck, even within a single codec it's hard to find complete support. Last I checked, browsers won't touch an H264 stream unless it's also YUV420p which also places certain restrictions on physical dimensions of the data and probably some other stuff that's escaping my mind.
If I'm making an image viewer, do I support SVG or PNG? For this example, let's say I only support PNG, but I can tell from the outset what's inside any file I might try to load. I can confidently say I can meaningfully load and display anything that uses the established standards of the PNG format to store image data. Sure, there are extensible bits, but they're not part of those core expectations surrounding the core part of the format, the image data I care about. And I didn't have to try and open the PNG first to see if it was actually an SVG. I can recognize not-bitmaps at a glance without having to inspect them any deeper than their extension.
Tell that to the lawyers when they send you a cease and desist.
The reason non-gpl compliant software don't touch GPL is not because there might be a loophole, it's that there is ni precident set in court and they don't be the ones needing to do it. This requires lawyers with expertise in both copyright law and contract law. It doesn't matter what is copyrightable if you agreed to a contract that you wouldn't do that and that is what the GPL is, a contract that you agree to that mentions how you are allowed to use the code in question.
In the end whether the GPL is enforceable in these edge cases is up to the courts not your interpretation of it and if you project becomes a roaring success do you really want to spend time and money on lawyers that you could rather spend on development.
This is different from vv which uses the headers to link to the GPLed code.
IN most jurisdictions the GPL is a license, not a contract, and is definitely designed not to be a contract.
That said, as far as I can see vv is in breach of the GPL. This is a case of someone who wants there to be a loophole convincing themselves there is one.
I would definitely not redistribute vv because of that. More importantly I think it likely that people packaging software for Linux repos are not going to want to take the risk, and many will object to trying to find a loophole in GPL on principle too.
Ah yes, "ni precident". I would suggest people instead get advice from someone who has some idea what they're talking about and a good grasp of the English language to communicate it.