Introducing Image Analysis with Imj

Introducing Image Analysis with Imj

I always incorporate image analysis as a method in the Introduction to Digital Humanities course that I teach, which is fantastic because it takes the students out of the realm of texts and quantitative analysis and allows them to explore different materials (images, film) in an introductory way. Image analysis in this context has always meant leading students through Imageplot (and ImageJ), which can be very challenging, as the software is not user friendly and can be finicky. So, I was thrilled to discover the Imj tool (Image Macroanalysis in Javascript) from Zach Whalen, since it enables some of the plotting that you do in Imageplot as well as a couple of other image visualizations. It is a browser based tool for pulling in sets of images and creating visualizations, with the option to download the visualizations for future use. It was created in 2016 (still can’t believe I just discovered this!) and launched as an alpha, and it does not look like it has been updated in a while. In my experience, everything has been running fine, however, but a note that it could break down, as things do.

It’s so easy to use that a full tutorial is almost unnecessary, but I wanted to showcase the tool anyway, so folks can see what can be created with it. It is also informative to check out Zach’s post explaining a bit about the tool.

The image dataset that I used for this example is a set of 146 covers from The Crisis, the official magazine of the NAACP. These images were gathered from the Modernist Journals Project and include covers from Vol. 1 No. 1 in November 1910 through Vol. 25. No. 2 in December 1922. Thanks to Kate Topham for compiling this image set.

What to do in a nutshell

To get started with Imj, simply go to the site and select your images (or a folder that holds the images) from your computer. Then, you can choose among three visualization types: Barcode, Montage, and Plot. I will show each of them below. For each visualization type, there are a couple of settings that you can adjust. Then, click “Apply Settings”, then “Do the Thing!”, and your visualization will be created below. You can save the viz by right clicking and saving image as, or by clicking “Download It” underneath “Do the Thing!”. That’s it!

What it looks like

Barcode

Below, I have selected the 147 Crisis covers (Step 1), have left the viz type as “Barcode” (Step 2), and I have left the other settings (Canvas width and height and Smoothing) in their default mode.

Loading in images and selecting visualization type and settings

In Step 3, the tool checks what files I have added, so all I need to do is click “Do the Thing!” and the Barcode viz is created below. As you can see, this visualization type, with no smoothing, takes all of the images and smashes them next to each other in a row.

Barcode Visualization using Default (No Smoothing) mode

If you adjust the settings in Step 2 so that Smoothing is set to “Average Color only“, click “Apply Settings” and then “Do the Thing!”, the barcode viz looks quite different. The system has calculated the average color for each image and, instead of displaying the image itself squashed into a row, it shows a color band.

Barcode Visualization using Average Color mode

If you adjust the settings in Step 2 so that Smoothing is set to “Dominant Color only“, click “Apply Settings” and then “Do the Thing!”, the barcode changes again. The system has calculated the dominant color for each image, so a color band is displayed, but it is different from Average Color.

Barcode Visualization using Dominant Color mode

If you adjust the settings in Step 2 so that Smoothing is set to “Color Palettes“, click “Apply Settings” and then “Do the Thing!”, the barcode viz changes a bit more dramatically. In this version, there are several color bands. I need to look into this further to understand what is going on here.

Barcode Visualization using Color Palettes mode

Montage

You can change the visualization type in Step 2, and below you can see what The Crisis covers image set looks like using “Montage.” Depending on the number of images you have, it might be useful to adjust the number of columns. The default number of columns is 50. For this data, in which we only have 157 images, I chose to create a montage with 10 columns only. I also adjusted the thumbnail width and height so that they would be larger and easier to see. Your thumbnail size needs will vary depending on the type of images you are working with and how many you have.

Selecting the Montage visualization type and seeing the setting options

Click “apply settings” and “Do the Thing” just like for the Barcode visualization type. The montage for my data looked like this:

Montage visualization type

Montage can be useful for this relatively small image set in order to quickly see all of the covers at once, even to some level of detail. If you are working with a much larger image set, the thumbnails may be much smaller, and your goals would likely be to prioritize individual image legibility less in order to show the images next to each other at scale.

Plot

The third visualization type will plot each image on a graph, like a histogram or scatterplot, but with the image displayed instead of a dot. In this tool, you can select from a variety of measurements that will be run by the program to serve as your x-axis and y-axis values. The options are: Lightness, Saturation, Red, Blue, Green, Hue, Luminance, Value, Brightness. The tool does not provide explanations for these values, so it would be worth digging deeper into the programs underlying Imj in order to understand a bit better what they mean.

Plot is the visualization type most like Imageplot. The main tradeoff in using Imj instead of Imageplot is that you must use the generated values for both the x and y axes, whereas in Imageplot, you could only look at one value (say, saturation) as the y-axis and use your own data to order things on the x-axis (for example, to show things over time).

That said, Plot in Imj is extremely easy to use and compelling in many cases. Below, I have created a plot of The Crisis covers with Lightness as the x-axis and Saturation as the y-axis.

Plot visualization type settings

With this visualization, we can see, for example, that lighter cover images have overall higher saturation values.

Plot, with Lightness as x-axis and Saturation as y-axis

Summing up

Overall, Imj is an extremely easy to use tool that enables exploratory work with large sets of images. Zach Whalen has created something that’s great for beginners and offers a window into more in depth questions and areas of discovery.

Leave a Reply

Your email address will not be published.