explain

This is a Java system to allow you to inspect various media files on the command line, regardless of the type of file (to some degree). To use it you pass in media files (e.g. images, mp3s), and it will spit out relevant information for that kind of file. For example, for an mp3 you may want to see the artist, for an image you may wan to see the size. If it can't determine the type of file (by extension), it will treat it as text.

Source + Release

Here is a tar ball of the source and a jar file, as well as the source and Makefile to browse:

explain.tar.gz
explain.jar
AbstractHandler.java
Explain.java
Handler.java
ImageHandler.java
MP3Handler.java
Makefile
Test.java
TextHandler.java
Util.java
Version.java

Example

Here's an example using some test files.

java -jar explain.jar testfiles/*

Name                          : darth.jpg
Size                          : 0.17 KB
Modified                      : Fri Jun 05 07:44:43 EDT 2009
Width                         : 400
Height                        : 400
ColorSpaceType                : YCbCr
NumChannels                   : 3
CompressionTypeName           : JPEG
Lossless                      : false
NumProgressiveScans           : 1
PixelAspectRatio              : 1.0
ImageOrientation              : normal

Name                          : hoffice-wireless.png
Size                          : 0.61 KB
Modified                      : Fri Jun 05 07:44:43 EDT 2009
Width                         : 269
Height                        : 465
ColorSpaceType                : RGB
NumChannels                   : 4
BlackIsZero                   : true
CompressionTypeName           : deflate
Lossless                      : true
NumProgressiveScans           : 1
PlanarConfiguration           : PixelInterleaved
SampleFormat                  : UnsignedIntegral
BitsPerSample                 : 8 8 8 8
PixelAspectRatio              : 1.0
ImageOrientation              : Normal
HorizontalPixelSize           : 0.35273367
VerticalPixelSize             : 0.35273367
Alpha                         : nonpremultipled

Name                          : noextension
Size                          : 44 bytes
Modified                      : Fri Jun 05 09:43:55 EDT 2009
# lines                       : 6
# words                       : 9

Name                          : test.mp3
Size                          : 1.53 MB
Modified                      : Fri Jun 05 07:44:44 EDT 2009
Bitrate                       : 247 KB/s
# channels                    : 2
Encoding type                 : MPEG Version 1 (ISO/IEC 11172-3)
Length                        : 494.1061 s
Sampling rate                 : 44100 Hz
Title                         : The Highest Journey
Artist                        : M83
Album                         : Digital Shades
Genre                         : Alternative Rock
Year                          : 2007
Comment                       : Amazon.com Song ID: 202558238
Track #1                      : 10/11

Name                          : test.txt
Size                          : 55 bytes
Modified                      : Fri Jun 05 09:50:55 EDT 2009
# lines                       : 6
# words                       : 8

If you include no files, you get something like this

java -jar explain.jar
I support the following formats:
 - [png, jpg, gif, bmp, tiff]: Images files
 - [mp3]: MP3 audio files
Everything else is handled as text