HIPI - Hadoop Image Processing Framework

tools/hibInfo

hibInfo is a simple tool for querying basic information about a HIB. It takes as input a HipiImageBundle (HIB) and displays to the console basic information about the images within the HIB such as their width and height along with user meta data and image EXIF data. It can also be used to extract individual images from a HIB as a stand-alone JPEG or PNG.

Compiling

Compile hibInfo by executing the following command in the HIPI tools directory (see our general notes on setting up HIPI on your system):
$> cd tools
$> gradle hibInfo:jar
	    

Usage

Run hibInfo by executing the hibInfo.sh script located in the tools directory. As with all of the tools scripts, running it without any arguments shows its usage:
$> ./hibInfo.sh
usage: hibInfo.jar <input HIB> [--show-exif] [--show-meta] [#index [--extract file.png] [--meta key]]
 -e,--extract <arg>   extract image to disk
 -h,--show-meta       display any image meta data
 -m,--meta <arg>      extract meta data value
 -x,--show-exif       display any image EXIF data 
     
hibInfo takes a single required argument and a number of oprtional arguments. The only required argument is the path to a HIB on the HDFS.

Example

If you specify only the required path to a HIB, then hibInfo will list basic information about all of the images that it contains (this may take a while if the HIB contains many images):
$> ./hibInfo.sh tigers.hib
Input HIB: tigers.hib
Display meta data: false
Display EXIF data: false
IMAGE INDEX: 0
   640 x 480
   format: 1
IMAGE INDEX: 1
   3210 x 2500
   format: 1
IMAGE INDEX: 2
   3810 x 2540
   format: 1
IMAGE INDEX: 3
   3210 x 2500
   format: 2
Found [4] images.
      
hibInfo can also be used to query information about a specific image in a HIB. This mode of operation avoids scanning the entire file, but rather performs a seek to the desired image offset. Here is an example of how hibInfo can be used to examine the image with index 1 and display the user meta data that was stored in the HIB when it was created:
$> ./hibInfo.sh tigers.hib 1 --show-meta
Input HIB: tigers.hib
Display meta data: true
Display EXIF data: false
Image index: 1
Extract image path: none
Meta data key: none
   3210 x 2500
   format: 1
   meta: {source=/Users/hipiuser/Desktop/Tigers/2.JPG}
     
In this case, tigers.hib was created with the hibImport tool, which stores the original path to the image on the local file system for the "source" key in the image meta data.

hibInfo also allows querying the image EXIF data:
$> ./hibInfo.sh tigers.hib 0 --show-exif
Input HIB: tigers.hib
Display meta data: false
Display EXIF data: true
Image index: 0
Extract image path: none
Meta data key: none
   640 x 480
   format: 1
   exif: {Resolution Units=inch, Compression Type=Baseline, Data Precision=8 bits, Number of Components=3, ... }
      
Finally, hibInfo can be used to extract an individual image as a stand-alone JPEG or PNG:
$> ./hibInfo.sh tigers.hib 1 --extract one.jpg
Input HIB: tigers.hib
Display meta data: false
Display EXIF data: false
Image index: 1
Extract image path: one.jpg
Meta data key: none
   3210 x 2500
   format: 1
Using image encoder: com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageWriter@33b1c5c5
Wrote [one.jpg]
      
Experiment with the other command line arguments to discover additional functionality.

Next

Read about tools/hibDump, which provides an alternative MapReduce program for querying basic information from a HIB.