Jump to content
AVIC411.com

Extract and Repackage Image.img


Recommended Posts

I developed a little java program which is able to extract all bmp files from my image.img located in the firmware folder AVICZ110\APL\MENU\.

 

Usage:

 

java -jar xtractor.jar

 

It generates a folder/file structure like this:

 


OutputFolder
|
|- 2M
|   |- 007_2M_AV-001.bmp
|   |- 007_2M_AV-001.bmp
|   |- 007_2M_AV-002.bmp
|   |- ...
|- 32k
|   |- 007_32K_AV-001.bmp
|   |- 007_32K_AV-002.bmp
|   |- 007_32K_AV-003.bmp
|   |- ...
|- pOver
|   |- 2M
|   |   |- 007_2M_OM-001.bmp
|   |   |- 007_2M_OM-002.bmp
|   |   |- 007_2M_OM-003.bmp
|   |   |- ...
|   |- 32K
|   |- GZ

 

Tested with Image.img from this firmware for my F9220BT:

 

Product		: AVICZ110
Release File	: APL
Release Version : 3.001000
Release Machine : BUILDL09

 

 

Only extracting is supported in this version. I'll implement repackaging of modified bmp's in the next version

and release the source code when all stuff is finished.

 

Would be great if somebody could test it with other firmwares/devices and let me know if it worked.

xtractor.zip

Link to post
Share on other sites

This is the complete file format spec, as far as i understood it:

 

Image File Format

* ----------+----------------------------+-----------
*  Position |	Field			 |   Size
* ----------+----------------------------+-----------
*     0     | Header Record (F1 only)	 | 40 bytes
*     0     | Header Record (F2 only)	 | 48 bytes
* ----------+----------------------------+-----------
* variable  | GZH Record (Gzip Header)   | 12 bytes
* variable  | GZH Record (Gzip Header)   | 12 bytes
* variable  | GZH Record (Gzip Header)   | 12 bytes
* ...       | ...			 | ...
* ----------+----------------------------+-----------
* variable  | GZF Record (Gzip File)	 | variable
* variable  | GZF Record (Gzip File)	 | variable
* variable  | GZF Record (Gzip File)	 | variable
* ...       | ...			 | ...
* ----------+----------------------------+-----------
* variable  | Directory Record		 | variable
* variable  | Directory Record		 | variable
* variable  | Directory Record		 | variable
* ...	    | ...			 | ...
* ----------+----------------------------+-----------

 

Header Record

* ----------+----------------------------+-----------+------------------------
*  Position |	  Field		         |   Size    |   Example Value
* ----------+----------------------------+-----------+------------------------
*     0     | Magic Bytes (F1 only)      | 4 bytes   | F1 F1 F1 F1
*     0	    | Magic Bytes(F2 only)	 | 4 bytes   | F2 F2 F2 F2
* ----------+----------------------------+-----------+------------------------
*     4	    | Number of files	 	 | 4 bytes   | 74 0C 00 00
* ----------+----------------------------+-----------+------------------------
*     8	    | Header Size (F1 only)	 | 4 bytes   | 28 00 00 00
*     8	    | Header Size (F2 only)	 | 4 bytes   | 30 00 00 00
* ----------+----------------------------+-----------+------------------------
*    12	    | ? Unknown ?		 | 4 bytes   | 00 00 00 00
*    16	    | ? Unknown ? (F2 only)	 | 4 bytes   | 30 00 00 00
*    20     | ? Unknown ? (F2 only)	 | 4 bytes   | 00 00 00 00
* ----------+----------------------------+-----------+------------------------
*  var	    | GZH Block Offset		 | 4 bytes   | 30 00 00 00
*  var	    | GZH Block Size		 | 4 bytes   | 70 95 00 00
* ----------+----------------------------+-----------+------------------------
*  var	    | GZF Block Offset		 | 4 bytes   | A0 95 00 00
*  var	    | GZF Block Size		 | 4 bytes   | 62 E6 83 00
* ----------+----------------------------+-----------+------------------------
*  var	    | Directory Block Offset	 | 4 bytes   | 02 C7 84 00
*  var	    | Directory Block Size	 | 4 bytes   | E5 5D 01 00
* ----------+----------------------------+-----------+------------------------

 

Gzip Header Record

* ----------+----------------------------+-----------+---------------
*  Position |	  Field	   		 |   Size    | Example Value
* ----------+----------------------------+-----------+---------------
*     0	    | GZF Record Offset          | 4 bytes   | 80 68 00 00
*     4	    | GZip Filesize	         | 4 bytes   | 75 00 00 00
*     8     | Unzipped BMP Filesize      | 4 bytes   | 84 02 00 00
* ----------+----------------------------+-----------+---------------

 

GZIP File Record

* ----------+----------------------------+-----------+-----------
* Position  |	  Field			 |   Size    |  Value
* ----------+----------------------------+-----------+-----------
*    0	    | Magic Bytes (gzip)	 | 3 bytes   | 1F 8B 08
*    3	    | Rest of gzip data		 | variable  |
*/

 

Directory Record

* ----------+----------------------------+-----------+---------+---------------------------
*  Position |	  Field			 |   Size    |  Style  |   Example Value(s)
* ----------+----------------------------+-----------+---------+---------------------------
*      0    | Type1			 | variable  |  ASCII  | "pOver", "vi", ""
*     var   | Delimiter			 | 1 byte    |   HEX   | 5C
*     var   | Type2			 | 2 bytes   |  ASCII  | "2M", "32K", "GZ"
*     var   | Delimiter			 | 1 byte    |   HEX   | 5C
*     var   | Filename			 | variable  |  ASCII  | "007_2M_OM-151.bmp"
*     var   | Delimiter			 | 1 byte    |   HEX   | 00
* ----------+----------------------------+-----------+---------+---------------------------

Link to post
Share on other sites

I implemented repacking and tried to recreate the image file from the extracted bitmaps. It works so far. But the generated gzip data is different:

 

Original GZip Data Bytes:

00000000h: 1F 8B 08 00 00 00 00 00 00 00 95 91 31 0E 80 20
00000010h: 10 04 6F B4 31 B1 B3 F2 09 BE 83 DE 5F F9 68 3A
00000020h: 04 4F 1B D9 90 DC 26 DB CC 14 84 DB 74 5E 93 3D
00000030h: 49 B5 47 ED FE 16 5B 9C 57 BF AD DE D9 BC 2D 39
00000040h: 67 2B A5 18 98 0C 68 03 DA 80 36 A0 0D 68 03 DA
00000050h: 80 36 7F FE 99 9E BB 51 BC 19 CD A3 89 BC 1B F9
00000060h: 57 E4 6E 91 5D BA 19 07 BB 2B DA 72 03 69 D7 60
00000070h: E1 84 02 00 00

 

Recreated Gzip Data Bytes:

00000000h: 1F 8B 08 00 00 00 00 00 00 00 95 92 21 0E 80 30 
00000010h: 10 04 77 C0 90 E0 50 3C 81 77 D4 F3 2B 1E 5D 57
00000020h: 5A 0A 06 16 71 9B AC 99 11 CD DD 35 ED C7 A0 2B
00000030h: A9 76 AB 5D EF A2 A9 F3 EA 97 B9 77 54 6F 4B CE
00000040h: 59 A5 14 81 6C C0 1B F0 06 BC 01 6F C0 1B F0 06
00000050h: BC 79 F3 C7 7C 79 37 8E 37 E3 79 34 91 77 23 73
00000060h: 45 F6 16 B9 8B BF E3 97 EA F7 9F 48 27 69 D7 60 
00000070h: E1 84 02 00 00

 

I tried various libraries and compression levels but the filesize or the resulting binaries have always been different from the original ones. Maybe the pioneer firmware doesn't complain about this, but i would prefer generating the files as close as possible to the original.

 

So i'll keep trying ...

Link to post
Share on other sites

I implemented repacking and tried to recreate the image file from the extracted bitmaps.

 

I've been trying to simply edit a bitmap and save it with the same settings as the original, but neither Paint nor GIMP are doing very well with it so far. Just opening the file, and resaving it over itself, changes the file's size.

 

I tried various libraries and compression levels but the filesize or the resulting binaries have always been different from the original ones. Maybe the pioneer firmware doesn't complain about this, but i would prefer generating the files as close as possible to the original.

 

So i'll keep trying ...

Have you tried repackaging the image file then reloading it onto a deck?

 

Something else that's odd: I ran Image.img through TrID, and it's being identified as "Lumena Paint Bitmap" (.CEL). Curiously enough, .cel files can handle multi-page bitmaps (several bitmaps per file). Unfortunately, Lumena is impossible to find, because it seems to have been an old win3.1 program. I tried a couple converters that claimed they could covert .cel files, but they failed.

Link to post
Share on other sites
  • 4 weeks later...
  • 5 months later...
  • 1 year later...
  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...