3 ms·
Clever. It's creating a 1x13 image and filling it, left to right, with rgb values that correspond to the hex values of each character in "Hello world!\n". Then
by tyingq 4y ago
Clever. It's creating a 1x13 image and filling it, left to right, with rgb values that correspond to the hex values of each character in "Hello world!\n". Then using the "gray:filename" output to flatten each RGB value (like #484848) into one grayscale value (like #48, 'H').
He first fills it with 6C, which corresponds to a lowercase 'l', to reduce the amount of points that need to be filled in with something different...since 'l' is repeated a lot in "Hello world\n".
Edit: A more compact way to get the same outcome:
$ convert 'inline:data:image/x-portable-graymap;base64,UDUKMSAxMwoyNTUKSGVsbG8gd29ybGQhCg==' gray:hello
- jwilk 4y agoHah, Cunningham's Law strikes again. Thanks! In my excuse, I developed this first for GraphicsMagick, which doesn't support "inline:".
- tyingq 4y agoNot sure Cunningham's law really applies here. I wasn't aware of the "gray:" functionality before this post. And, as you say, doesn't work on gm anyway :)
- metadat 4y agoFor those unfamiliar with "Cunningham's Law": > Cunningham's Law states "the best way to get the right answer on the internet is not to ask a question; it's to post the wrong answer." > The concept is named after Ward Cunningham, the inventor of wiki software.