Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 62749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:31:29+00:00 2026-05-10T18:31:29+00:00

I stumbled across my rather ancient photo objects disks, and sadly found out the

  • 0

I stumbled across my rather ancient photo objects disks, and sadly found out the company (hemera) doesn’t provide support for it anymore. this has left me with a whole pile of .hpi files. Luckily, I found this information on extracting the jpg and png components of the file.

Unfortunately, I haven’t been able to get it to work. Can anyone figure out what’s wrong with this code? I’d be happy with a PHP or Python solution if Perl isn’t your thing. 🙂

open(I, '$name') || die; binmode(I); $_ = <I>; close(I);  my ($j, $p) = m|^.{32}(.*)(\211PNG.*)$|s; open(J, '>$name.jpg') &&     do { binmode(J); print J $j; close J; }; open(P, '>$name.png') &&     do { binmode(P); print P $p; close P; }; 

The hexdump of the current test file I snagged off a CD is here, if it helps at all:

0000000 89 48 50 49 0d 0a 1a 0a 64 00 00 00 20 00 00 00 0000010 45 89 00 00 65 89 00 00 0a 21 00 00 00 d0 d0 00 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:31:29+00:00Added an answer on May 10, 2026 at 6:31 pm

    It seems the regexp is wrong. That’s why I wrote a little C program to do it for me:

    #include <stdio.h> #include <stdlib.h>  #define MAX_SIZE 1048576  char stuff[MAX_SIZE];  int main (int argc, char **argv) {     unsigned int j_off, j_len, p_off, p_len;     FILE *fp, *jp, *pp;     fp = fopen (argv[1], 'r');     if (!fp)    goto error;     if (fseek (fp, 12, SEEK_SET))   goto error;     if (!fread (&j_off, 4, 1, fp))  goto error;     if (!fread (&j_len, 4, 1, fp))  goto error;     if (!fread (&p_off, 4, 1, fp))  goto error;     if (!fread (&p_len, 4, 1, fp))  goto error;     fprintf (stderr, 'INFO %s \t%d %d %d %d\n',         argv[1], j_off, j_len, p_off, p_len);     if (j_len > MAX_SIZE || p_len > MAX_SIZE) {         fprintf (stderr, '%s: Chunk size too big!\n', argv[1]);         return EXIT_FAILURE;     }      jp = fopen (argv[2], 'w');     if (!jp)    goto error;     if (fseek (fp, j_off, SEEK_SET))    goto error;     if (!fread (stuff, j_len, 1, fp))   goto error;     if (!fwrite (stuff, j_len, 1, jp))  goto error;     fclose (jp);      pp = fopen (argv[3], 'w');     if (!pp)    goto error;     if (fseek (fp, p_off, SEEK_SET))    goto error;     if (!fread (stuff, p_len, 1, fp))   goto error;     if (!fwrite (stuff, p_len, 1, pp))  goto error;     fclose (pp);     fclose (fp);     return EXIT_SUCCESS;  error:     perror (argv[1]);     return EXIT_FAILURE; } 

    It works with the command line parameters input.hpi output.jpg output.png. The error handling is not 100% correct, but it is good enough to always tell you if something’s wrong, and most times what it is. For large files, you will have to enlarge MAX_SIZE.

    Here is a shell script which you can call with *.hpi:

    #!/bin/bash  dest=<destination-folder>  for arg in '$@' do   base=`echo $arg | cut -d'.' -f1`   <executable> $arg $dest/original/$base.jpg $dest/mask/$base.png 2>>$dest/log   #composite -compose CopyOpacity $dest/mask/$base.png $dest/original/$base.jpg $dest/rgba/$base.png done 

    The optional composite command (comes with ImageMagick) will create a new PNG image which has the mask applied as alpha channel. Note that this file will be about 5 times larger than the original files.

    Note that some HPI files come without mask. In this case, my program will still work, but give an empty PNG file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The SQL Server has basic auditing which can audit logins… May 11, 2026 at 11:17 am
  • added an answer Have a look at the fcntl options. Maybe F_GETFL with… May 11, 2026 at 11:17 am
  • added an answer I faced the same question a couple years ago. The… May 11, 2026 at 11:17 am

Related Questions

I stumbled across my rather ancient photo objects disks, and sadly found out the
I stumbled across this code and am too proud to go and ask the
I am working on a project using Castle Active Record. I stumbled across the
I recently stumbled across this entry in the google testing blog about guidelines for
I just stumbled across this bug in some legacy code: class MyAPIHandler { private:
I've stumbled across this great post about validating parameters in C#, and now I
I'm trying out ASP.NET MVC routing and have of course stumbled across a problem.
I stumbled over this passage in the Django tutorial : Django models have a
Today I stumbled about a Problem which seems to be a bug in the
On my reading spree, I stumbled upon something called Intentional Programming . I understood

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.