rdjpgcom, wrjpgcom, imgsize, and convert for OSX
rdjpgcom, wrjpgcom, convert and imgsize are 4 file utilities for manipulating image files. They are not installed in Mac OSX by default, but adding them is simple.
- rdjpgcom displays text comments from a JPEG file.
- wrjpgcom inserts text comments into a JPEG file.
- imgsize reports the height/width of an image file (several formats)
- convert does several manipulation things, but I use it primarily for creating thumbnails, like so:
convert -scale 110x110 -antialias -quality 60 $i thumbs/$i
(where $i is the name of the input file)
I use these so often I was surprised that they were not part of the standard distribution, but I'm sure everyone has their own pet projects. The good news is that once you find the source code, getting these to work on OS X is easy.
rdjpgcom and wrjpgcom compile cleanly out of the source code available at http://osx.freshmeat.net/projects/libjpeg/
convert is part of ImageMagick. There is a ImageMagick package for OS X here.
imgsize is a part of Image::Size (a Perl module, or whatever they're called) which I found at Blackperl.com.
Compiling and installing was easy. ImageMagick is a pkg file so it was a matter of clicking. libjpeg was a simple configure && make && sudo make install. imgsize was also easy (read the README).
Only thing that wasn't smooth was that imgsize installed to /usr/bin/ instead of /usr/local/bin and man pages went to / instead of /usr/local/man. I probably could have avoided that by reading more documentation and setting something properly. In general I like to avoid putting new stuff anywhere but /usr/local/. I know others feel differently.
When I was writing this I wondered how many people reading it would think either a) all these features ought to come in one program rather than 4, or b) at least rdjpgcom and wrjpgcom ought to be one program. Then I remember a good link about The Unix Philosophy. Those two programs embody one of the essential tenets: "Make each program do one thing well." imgsize also embodies that attitude; it is a simple program that does one thing: reports the size of an image file. It can reformat the output a couple ways, but essentially that's all it does.
You could write one big program that converts, reads, writes, and reports the size (dimensions) of an image file, but that's not the Unix way.
Anyway, I put all the various links here in case someone else was looking for them, and to remind me in case I need them later.