Search form

HPI Image Extractor

The various Hemera Photo-Objects libraries aren’t much use to designers anymore, since the image format is proprietary and the browser software obsolete. But it turns out the file format is basically a container for a JPG of the image and a PNG of the mask.

Ed Halley offered a short Perl script to extract the image and mask from an HPI, but the code is apparently a little out of date and wouldn’t run on my OS X 10.9 «Mavericks» system. So I tweaked it a bit, and now I can use my Photo-Objects again. I’m posting it here in case anyone else has the same problem:

#!/usr/bin/perl

# HPI image converter script
# based on a similar script by Ed Halley
# at http://www.halley.cc/ed/linux/interop/hemera.html

# get the name of the folder with HPI images from user
print "\nEnter the path of the folder holding your HPI images:\n\n";
my $source_dir = <STDIN>;
chomp $source_dir;

# open the HPI source directory
opendir(DIR, $source_dir) or die "cannot open directory";

# get the name of the destination folder for PNG/JPG images
print "\nEnter the path of the destination folder for the PNG/JPG images:\n\n";
my $destination_dir = <STDIN>;
chomp $destination_dir;