There are at least a hundred ways of doing this, but I wanted a single-line way to make greyscale versions of a bunch of images on a website I was developing. The last thing I wanted was to load each one in turn into a graphics application to edit the colors.
ImageMagick to the rescue:
for img in *.gif ; do convert $img -colorspace Gray -colors 16 grey_$img ; done
Ok - so not really one line, but
almost :-)
And this is what it looks like afterwards in my file explorer:
3 comments:
HURRAH!!!!! Another post at last ... looks impressive; I'll ask Luke if it is ;-) Do you think you could write something (as many lines as you like!) that makes chocolate come out of my printer instead of paper?
OK. That was a hard one, but here it is. I figured out how to make nice brown chocolate come out your printer:
----------------------------
%!
%% Chocolate
/Times-Roman findfont
62 scalefont
setfont
100 200 translate
45 rotate
2 1 scale
newpath
20 0 moveto
(Chocolate) true charpath
gsave
0.5 0.3 0.1 setrgbcolor
fill
grestore
0.5 setlinewidth
0.4 setgray
stroke
showpage
----------------------------
OK - I admit I failed to stop the paper coming out with it, but I think with a little more research we can crack that one too :-)
(P.S. To use the above recipe, simply save the text between the '----' lines to a file called chocolate.ps. Then print that file.)
(P.P.S. Credits to the ps-tutorial at UWA.)
See P.S. If this instruction fails, try alternative command:
call know-it-all-teenage-computer-chappie saying "Luke, do this for me! It's from that very clever bloke in Sweden!" and he'll be here like a shot. Mind you, he'll probably eat the flippin' choccy too! *sigh*
I'm back to Amadei ...
Post a Comment