The slides and code from my NICAR 2016 talk.
PHP JavaScript
Latest commit 8b50168 Mar 14, 2016 @jonkeegan Update

Command Line Graphics

@jonkeegan |

Slides from my talk "Command Line Graphics" at NICAR 2016:



brew install node
brew install imagemagick
brew install ffmpeg
brew install exif

Pillbox demo: Exporting histograms, sorting by hue, saturation and value

Download the data and the pill photos

You can get the raw data from here:


Setup database

In data.php you must enter your database name. It's set up assuming you are using MAMP, with a local MySQL server.

Just use the mysql_create_engine_data_20150511.txt file to setup the database. I renamed the table pillbox.

Place all of the pill photos into pill_photos.

Process images

node analyze_pills.js >
node build_sorted_list.js > jumbo_with_dom_sat.json

Sample data call

All "BLUE" pills: data.php?filter=splcolor_new&value=C48333

All round shapes: data.php?filter=splshape_new&value=C48348

Use node to extract EXIF metadata form images

The parse_exif.js node script will loop through the samples/ directory, and extract the EXIF metadta, and console.log out the metadata for each image in one JSON object.

node parse_exif.js > photo_metadata.json