5 ms·
It uses various Imagemagick tools (Imagemagick supports sixel). Nobody manipulates binary files/pixel data in bash, do they?
by theoh 8y ago
It uses various Imagemagick tools (Imagemagick supports sixel).
Nobody manipulates binary files/pixel data in bash, do they?
- aasasd 8y ago> nobody That's a strong word you have there.
- floatingatoll 8y agoThey have a point - I can’t find any traces of a shell library implementing image parsing without calling out to a third-party tool written in not-shell. You also have a point - I’m seriously debating if I can write one in an evening solely to say that one now exists. (I lost the debate with myself, sadly.) EDIT: I mean “source language bash”, not “target language bash”, my emscripten friends.
- theoh 8y agoThere are problems with the manipulation of binary data in bash, as discussed here: https://unix.stackexchange.com/questions/278639/how-can-i-work-with-binary-in-bash-to-copy-bytes-verbatim-without-any-conversio https://unix.stackexchange.com/questions/278639/how-can-i-wo... In particular, the value 0 can't be stored in a bash variable, which almost completely rules out the possibility of byte-by-byte processing of general binary data. It's probably possible with absurd hacks. Quite apart from that, error handling in bash is an awkward chore which few scripts get right. It's a very unappealing language for writing anything more than a five-line script. https://www.davidpashley.com/articles/writing-robust-shell-scripts/ https://www.davidpashley.com/articles/writing-robust-shell-s...
- floatingatoll 8y agoIf you read a byte without EOF and have a variable length of 0 afterwards, you read a NUL.
- benj111 8y agoI'd like to think that it was a trap (that floating atoll at least fell in to). This time next year we'll be reading about Bixel (free to use if you build it), the new hotness in binary and pixel editing.
- boomlinde 8y agoPixel data doesn't necessarily imply binary data, though. In the Plain PPM format, pixels are encoded as plain text RGB tuples separated by white space. It's not inconceivable for such a simple format that one could write a simple image processor in a few lines of shell + coreutils.