Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's pretty incredible that this is a bash script that outputs sixel graphics, and it in no way makes use of libsixel[0].

[0] https://github.com/saitoha/libsixel



It uses various Imagemagick tools (Imagemagick supports sixel).

Nobody manipulates binary files/pixel data in bash, do they?


Pixel 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.


> nobody

That's a strong word you have there.


They 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.


There are problems with the manipulation of binary data in bash, as discussed here: 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-s...


If you read a byte without EOF and have a variable length of 0 afterwards, you read a NUL.


I'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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: