GimConv: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
mNo edit summary
 
(68 intermediate revisions by the same user not shown)
Line 1: Line 1:


=Description=
=Description=
'''GimConv v1.20h''' was released with '''p3tcompiler v2.00''' as part of the [http://uk.playstation.com/ps3/support/settings/detail/linked235336/item85346/Download-PlayStation-3-Custom-Theme-Guidelines/ PS3 Custom Theme Toolbox]
'''GimConv.exe''' is a sony program for microsoft windows used to convert GIM images, see [[Graphic Image Map (GIM)]]


Is the responsible of the [[Multimedia Formats and Tools | .GIM]] image conversions that are used inside [[Resource Container (RCO)]] files, [[PlayStation 3 Theme (P3T)]] files, etc...
*GimConv.exe versions:
**'''1.20c''' (it can be seen in the [[Graphic_Image_Map_(GIM)#0xFF_.28Fileinfo.29 |fileinfo block]] of GIM images with timestamp from november 2005, since firmware 0.82.006)
**'''1.20d''' (it can be seen in the [[Graphic_Image_Map_(GIM)#0xFF_.28Fileinfo.29 |fileinfo block]] of GIM images with timestamp from march 2006, since firmware 0.85.007)
**'''1.20e''' (it can be seen in the [[Graphic_Image_Map_(GIM)#0xFF_.28Fileinfo.29 |fileinfo block]] of GIM images with timestamp from april 2006, since firmware 0.85.007 and still present in PS3 4.82 firmware)
**'''1.20h''' released with '''p3tcompiler v2.00''' as part of the [http://uk.playstation.com/ps3/support/settings/detail/linked235336/item85346/Download-PlayStation-3-Custom-Theme-Guidelines/ PS3 Custom Theme Toolbox] (this is the version included in rcomage using a modifyed GimConv.cfg)


*Other notes:
*Other notes:
**Gim images can be previewed in PC by using '''Gim Viewer''' (unnofficial app made by hsreina, it has partial support for the GIM formats used in PS3). See [[Multimedia_Formats_and_Tools#GIM | Multimedia Formats and Tools]]
**GIM images can be previewed in PC by using '''Gim Viewer''' (unnofficial app made by hsreina, it has limited support for the "rgba based" GIM formats). See [[Multimedia_Formats_and_Tools#GIM | Multimedia Formats and Tools]]
**The option '''-viewer (start gimview.exe when process ends)''' in the config file points to an official gim viewer that doesnt exists in the public release
**The option '''-viewer''' (start gimview.exe when process ends) in the official config file (that was removed for rcomage) is intended to launch an official '''gimview.exe''' that doesnt exists in the public release
**[http://us.playstation.com/support/manuals/psp/pspguides/ PSP Custom Theme Toolbox] admits .GIM files as inputs, but doesnt includes a gim converter
**[http://us.playstation.com/support/manuals/psp/pspguides/ PSP Custom Theme Toolbox] admits GIM files as inputs, but doesnt includes an standalone GIM converter
**Speculation about animated images support http://endlessparadigm.com/forum/showthread.php?tid=5054
**Some of the settings (such '''merge_mode''') seems to be related with animated images but the support of animated GIM images on PlayStation consoles is unknown, see: [http://endlessparadigm.com/forum/showthread.php?tid=5054 talk]
**Supports AVI video as input, converts the video frames to static images and build a multiframe GIM with them
**Supports an internal script format to automatize image conversions, there is one script definition located at bottom of Gimconv.cfg named "Filter". The usage of this scripting features is unknown
**It uses an intermediate format named '''GIS''' that seems to be related with the scripting features
**There is a [http://tizzyt-archive.blogspot.com.es/2013/10/gis2png.html GIS2PNG converter] made by TizzyT


=Usage=
=GimConv.cfg Overview=
The command line help of GimConv.exe displays a very limited list of options with an small explain, some are generic for the tool usage, and others works as lables that loads one option or a group of options from the config file (GimConv.cfg)
Before explaining how GimConv.exe works is needed an introduction about GimConv.cfg (the config file). All features of GimConv.exe are driven by the settings that appears on GimConv.cfg


{{Keyboard|content='''C:\PS3_Custom_Theme_v200\GimConv>GimConv.exe'''
The contents of GimConv.cfg are loaded "from top to bottom" first are loaded the default settings, and then the settings inside the option (incase you enable some option/s, otherway the options are ignored). When enabled, the settings inside the options (at bottom ofGimConv.cfg) are going to "override" the default settings (at top of GimConv.cfg), this overriding also happens with any setting or option you use in command line, as example, if you change the same setting 3 times in a single command line the only setting that counts is the last one
gimconv ver 1.20h --- generic picture converter
usage {
Copyright (C) 2006 Sony Computer Entertainment Inc.
        This is the help screen (only informative)
  All Rights Reserved.
}
 
default {
usage:
        Default predefined settings (loaded "from top to bottom", if a setting is repeated two or more times the most at bottom overrides the other/s at top)
        gimconv <input files> [options]
}
 
input * {
options:
        Settings for input file formats
        -interact      input additional options
}
        -pictures      merge files as pictures
option * {
        -frames        merge files as frames
        Groups of settings (overrides the defaults settings, are only used when you specify the option name at the command line)
        -levels        merge files as levels
}
        -prompt        prompt always
script * {
        -warning        prompt on warning
        Unknown
        -error          prompt on error
  }
        -viewer        start gimview.exe when process ends
        -o <filename>  specify output file name
        -s <w,h>        resize image data
        -S              output text format
        -P              resize image data to a power of two
        -N              output in normal pixel storage format
        -F              output in faster pixel storage format
        -R              re-convert ( don't swap RGBA <-> ABGR )
}}
 
==GimConv.exe==
By specifying an option, or a group of options from command line by his labels (using the names that appears in the help screen, or using the names that appears inside the GimConv.cfg file)
{{Keyboard|content='''gimconv.exe test.png -o test.gim --DXT'''}}
*Note the DXT label at the bottom of GimConv.cfg is composed by 3 options:
**Warning: the option -DXT has been deleted in the GimConv.cfg provided with rcomage, for more detailed changes in that custom GimConv.cfg file see the {{talk}} page
{{Boxcode|content=<syntaxhighlight lang="c">
option -DXT {
pixel_order = default
pixel_channel = default
image_format = default
}
</syntaxhighlight>}}
 
----
By specifying the options strictly from command line (using the names that appears inside the GimConv.cfg file). This is the most accurate way to specify options and to have full controll of all the gim settings
{{Keyboard|content='''gimconv.exe test.png -o test.gim --format_style psp --format_endian big --pixel_order normal'''}}
*Note the 3 options used in the example are overriding the default settings at top of GimConv.cfg:
{{Boxcode|content=<syntaxhighlight lang="c">
//----------------------------------------------------------------
// default settings
//----------------------------------------------------------------
pixel_order = default // default normal faster
format_style = psp // std psp ps3
format_endian = little // little big
</syntaxhighlight>}}


----
Below is shown GimConv.cfg released by sony as part of the [http://uk.playstation.com/ps3/support/settings/detail/linked235336/item85346/Download-PlayStation-3-Custom-Theme-Guidelines/ PS3 Custom Theme Toolbox] (official version)
By sending .gim settings from rcomage.exe ---to---> gimconv.exe when compiling the .rco (see the "compile" help in [[rcomage]] page). There are 2 options in rcomage specific for this task, named: '''--gimconv-cmd''' and '''--gimconv-flags'''
{{Keyboard|content='''rcomage.exe compile test.xml test.rco --gimconv-cmd ".\gimconv\gimconv.exe" --gimconv-flags "--format_style psp --format_endian big --pixel_order normal"'''}}


==GimConv.cfg==
{{Boxcode|height=520px|title=GimConv.cfg (original)|code=<syntaxhighlight lang="c">
This is the configuration file that defines the help screen, and contains the default values and all available options. The next example is the configuration file provided by sony as part of the [http://uk.playstation.com/ps3/support/settings/detail/linked235336/item85346/Download-PlayStation-3-Custom-Theme-Guidelines/ PS3 Custom Theme Toolbox]
<div style="height:520px; overflow:auto">
{{Boxcode|content=<syntaxhighlight lang="c">
//================================================================
//================================================================
//  gimconv configuration
//  gimconv configuration
Line 320: Line 288:
}
}
</syntaxhighlight>}}
</syntaxhighlight>}}
</div>


Note there are some modifications made officially by sony at a later version because GimComv was initially made for PSP (those initial GimComv versions compatibles with "PSP only" probably didnt had this PS3 specific settings), but this public release of GimConv was released as part of a toolkit to build PS3 themes so it has some settings specific for PS3
The config file released with [[Rcomage]] have some default settings modifyed that are problematic for PS3 compatibility. For more info about the modifications made in the config file released with [[rcomage]] see the differences in the {{talk}} page


This group at top on the config file are default settings (for PS3) that overrides other default settings of an older version of GimComv (for PSP). They are overwriting default values because the same option is specifyed before in the file, so the last one overrrides the previous one with the same name (and also was added a new option named '''extend_edge''' that should be PS3 specific)
=GimConv.exe usage=
{{Boxcode|content=<syntaxhighlight lang="c">
 
//----------------------------------------------------------------
==Help screen==
//  default settings
The help screen of GimConv.exe displays a few options with an small explain about them, the example below belongs to the official GimConv.cfg with the options sony considered useful, this options are mostly useless for us, in short: interact doesnt allows to do special things, the merge modes are hardcore because are intended to create GIM files by some kind of artisan method where you create the GIM by using "pieces" from other files, the promt modes doesnt helps much, gimview.exe doesnt exists, the image resize methods should not be used (instead you should prepare your images with the correct size before converting them with GimConv.exe), the pixel formats normal/faster should not be used that way individually, and the options to swap rgba color channels are not needed for PS3
//----------------------------------------------------------------


// PS3 OSD default settings
{{Keyboard|content=<syntaxhighlight lang="bash">
C:\PS3_Custom_Theme_v200\GimConv>GimConv.exe
gimconv ver 1.20h --- generic picture converter
  Copyright (C) 2006 Sony Computer Entertainment Inc.
  All Rights Reserved.


format_endian = big // -B
usage:
pixel_order = normal // -N
        gimconv <input files> [options]
pixel_channel = default // -R
image_format = rgba8888 // --image_format rgba8888


extend_edge = off
options:
        -interact      input additional options
        -pictures      merge files as pictures
        -frames        merge files as frames
        -levels        merge files as levels
        -prompt        prompt always
        -warning        prompt on warning
        -error          prompt on error
        -viewer        start gimview.exe when process ends
        -o <filename>  specify output file name
        -s <w,h>        resize image data
        -S              output text format
        -P              resize image data to a power of two
        -N              output in normal pixel storage format
        -F              output in faster pixel storage format
        -R              re-convert ( don't swap RGBA <-> ABGR )
</syntaxhighlight>}}
</syntaxhighlight>}}


This other group seems to be options for GIM formats used in PS3
==Options==
{{Boxcode|content=<syntaxhighlight lang="c">
{{Boxtip1|content=To specify an option is needed to use '''a single dash''' with the name of the option.}}
//--------------------------------------------------------
GimConv.exe allows to make a GIM-to-PNG conversion by specifying the file extension with the option '''-o''':
//  PS3 OSD specific options
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe in.gim -o out.png</syntaxhighlight>}}
//--------------------------------------------------------


option -B {
If you make a PNG-to-GIM conversion (or any of the supported input formats to GIM) without specifying any other option then are going to be loaded all the default settings of GimConv.cfg (from top to bottom) and this is not good because you dont have much control of the resulting GIM, most probably is going to generate a GIM file not compatible with PS3, at this point maybe you thought in creating a modifyed GimConv.cfg with all the default settings required by PS3 but this is not good enought either because there are (at least) 2 different GIM formats used in PS3 and you are going to break the compatbility with PSP, anyway here is the command as an usage example
format_endian = big
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe in.png -o out.gim</syntaxhighlight>}}
}
 
option -X {
pixel_channel = abgr
}
 
option -R {
pixel_channel = default
}


The interesting options are located at middle of GimConv.exe and contains several settings, this is an example of an option that is overriding the most critical settings (is a bit pointless thought, because the settings are given the value "default")
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe in.png -o out.gim -DXT</syntaxhighlight>}}
The option '''-DXT''' used in this example contains 3 settings that are going to be loaded after the default settings (this is an example of the official GimConv.cfg, the one used inside rcomage is different):
{{Boxcode|code=<syntaxhighlight lang="c">
option -DXT {
option -DXT {
pixel_order = default
pixel_order = default
Line 363: Line 340:
image_format = default
image_format = default
}
}
</syntaxhighlight>}}


option -E {
Another example where can be seen better how the options contains settings that overrides the default settings:
extend_edge = on
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe in.gim -o out.gis -S</syntaxhighlight>}}
*The option '''-S''' contains this settings:
{{Boxcode|code=<syntaxhighlight lang="c">
option -S {
output_object = off
output_script = on
}
}
</syntaxhighlight>}}
</syntaxhighlight>}}
At top of GimConv.cfg (as part of the default settings) appears the settings: '''output_object''' with value '''on''' and '''output_script''' with value '''off''' (so by default gimconv.exe outputs a GIM and doesnt outputs a GIS). The option '''-S''' of this example is switching them (doesnt outputs a GIM but it outputs a GIS)
==Settings==
{{Boxtip1|content=To specify a setting is needed to use '''a double dash''' with the name of the setting.}}
This is the most accurate way to have full controll of the GIM settings, if you are picky you can write a long line of settings to override all the critical default settings (just incase the GimConv.cfg was modifyed by someone, by doing this you are overriding his/her changes made to the default settings). If you are writing an script or any tool that sends actions to gimconv.exe you should use this method
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe in.png -o out.gim --pixel_order normal --format_style psp --format_endian big</syntaxhighlight>}}
The 3 settings in the example are overriding the default settings at top of GimConv.cfg (this is an example of the official GimConv.cfg, the one used inside rcomage is different):
{{Boxcode|code=<syntaxhighlight lang="c">
//----------------------------------------------------------------
//  default settings
//----------------------------------------------------------------
pixel_order = default // default normal faster
format_style = psp // std psp ps3
format_endian = little // little big
</syntaxhighlight>}}
==Cumulative options and settings==
{{Boxtip1|content=Reminder: options are passed with '''a single dash''' and settings with a '''double dash'''}}
This is the official way, the predefined options of the official GimConv.cfg are intended to be used together with other options, this way you can have an option containing a group of settings (that are common for a console) and several other options for the different GIM formats supported in that console, using GimConv.exe this way is a bit more confusing though and makes harder to pass commands to it, but is very handy to make tests
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe in.png -o out.gim -DXT --pixel_channel brag</syntaxhighlight>}}
The command in the example is loading the option '''-DXT''' like in the example above, but additionally is overriding one of the settings inside '''-DXT''' with the '''--pixel_channel brag''' to reorder the color channels (from left to right, BLUE, RED, ALPHA, GREEN), the resulting GIM is going to be like the one made in the example above, the only difference is the location of the pixel colors
It allows to cummulate many options and settings <abbr title="the rule to remember is... the last setting overrides the previous ones with the same name">in any order</abbr> (be careful this could create some problems) to do something like this:
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe in.png -o out.gis -DXT --pixel_channel brag -S</syntaxhighlight>}}


===Custom configurations===
==From rcomage==
The configuration file allows to modify the ''help'' screen of the command line by adding custom labels, or by removing useless options to make room for more custom labels, this labels can be composed of groups of options, there is no need at all to do this because doesnt really enables any new funcionallity as you can specify all the options you need one by one from command line included the hability to override default values, but is good to keep a record of the most common used formats for a console by using custom labels with intuitive names that defines the GIM format
{{Boxwarning1|content='''Dont use this method for PS3'''. GIM files from PS3 firmware uses (at least) 2 different GIM formats, rcomage applyes the same settings for all the GIM files so some are broken}}
This ones are rcomage commands that includes gimconv commands in between quotes, are optional and are intended to change the default GIM settings used by rcomage when doing the PNG-to-GIM conversions. Rcomage.exe sends the GIM settings to gimconv.exe when is compiling the RCO (see the "compile" help in [[rcomage]] page). There are 2 options in rcomage specific for this task, named: '''--gimconv-cmd''' and '''--gimconv-flags'''
{{Keyboard|content=<syntaxhighlight lang="bash">rcomage.exe compile in.xml out.rco --gimconv-cmd ".\gimconv\gimconv.exe" --gimconv-flags "--pixel_order normal --format_style psp --format_endian big"</syntaxhighlight>}}


The config file supplyed by [[Rcomage]] contains some custom options for the formats that are used in PSP, some changes in the default settings that was common for PSP (included a size limit that breaks compatibility with PS3), and a group of options was added for PS3 (labeled '''-ps3''') but this group seems to use wrong options. For more info about the modifications made in the config file supplyed with [[rcomage]] see the differences in the {{talk}} page
As mentioned [http://endlessparadigm.com/forum/showthread.php?tid=19501&pid=350611#pid350611 here] inside RCO files from PS3 official firmwares there are (at least) 2 types of GIM formats, and usually both are used inside the same RCO, as example... an RCO with a total of 14 GIM files where 12 of them was made using some GIM settings, and the other 2 with different GIM settings, for this reason is needed to identify the GIM settings and rebuild every GIM file individually


This wiki section proposes new groups of options with new label names (to be able to use a new modifyed config file without breaking the compatibility of other tools that uses rcomage as a dependency)
Is not posible to compile a PS3 RCO with rcomage by using PNG images as source (either way, using the commands in the example above or not using them, the problem is the same) because the GIM settings sent by rcomage are applyed to all the PNG images, so all the GIM files in the RCO will have the same GIM settings, '''this doesnt works for PS3 GIM files !'''
{{How to rebuild a PS3 RCO with custom GIM images using Rcomage and GimConv}}


The label names proposed here doesnt makes sense at this point, feel free to add more groups of settings with any label name following this same method, also add some info about how many images uses this format (if posible)
=GimConv.cfg options for PS3=
You can modify the GimConv.cfg file by adding some options (with custom names) containing any settings, by doing this you can keep a record of the correct settings for some GIM formats and group lot of settings under a single option, additionally when using GimConv.exe from command line the commands will be much shorter. This wiki section proposes a couple of options (but probably PS3 supports a lot more) that have been tested and are the first and second most commonlly used in PS3 official firmwares


*Inside [[explore_plugin]]_full.rco from firmware 4.70 there are 245 images, 201 of them (included the new icon tex_psn.gim) has been made by using this options:
*'''1st most common''' GIM format used in official PS3 firmwares
{{Boxcode|content=<syntaxhighlight lang="c">
{{Boxcode|code=<syntaxhighlight lang="c">
option -ps3bpp32 {
option -ps3rgba8888 {
format_style = psp
format_endian = big
format_endian = big
image_format = rgba8888
pixel_order = normal
pixel_channel = default
pixel_alpha = default
}
</syntaxhighlight>}}
*Inside [[explore_plugin]]_full.rco from firmware 4.70 there are 245 images, 30 of them has been made by using this options:
{{Boxcode|content=<syntaxhighlight lang="c">
option -ps3osdold {
format_style = psp
format_style = psp
format_endian = big
image_format = rgba8888
image_format = rgba8888
pixel_order = normal
pixel_order = normal
pixel_channel = default
pixel_channel = rgba
pixel_alpha = default
limit_image_width = 4096
update_fileinfo = on
limit_image_height = 4096
}
}
</syntaxhighlight>}}
</syntaxhighlight>}}


*Inside [[explore_plugin]]_full.rco from firmware 4.70 there are 245 images, 14 of them has been made by using this options:
*'''2nd most common''' GIM format used in official PS3 firmwares
{{Boxcode|content=<syntaxhighlight lang="c">
{{Boxcode|code=<syntaxhighlight lang="c">
option -ps3dxt5 {
option -ps3dxt5 {
format_endian = big
format_style = psp
format_style = psp
format_endian = big
image_format = dxt5
image_format = dxt5
pixel_order = normal
pixel_channel = default
pixel_channel = default
pixel_alpha = default
limit_image_width = 4096
limit_image_height = 4096
}
}
</syntaxhighlight>}}
</syntaxhighlight>}}


*Any other (this 2 options seems to be common for all ps3 4.70 rco's)
=How to identify GIM settings=
{{Boxcode|content=<syntaxhighlight lang="c">
The goal is to identify the GimConv settings that was used when the original GIM file was created, there are basically two ways to identify GIM settings, by reading the GIM structure, or by bruteforce
option -ps3wiki2 {
 
format_style = psp
Both identification methods can be made manually or by using external code, and are not exclusive. For code performance reading the GIM structure is faster, but for accuracy the bruteforce method is 100% accurate, so a code could start reading "what we know" from the GIM structure and then start with the bruteforce to get the confirmation
format_endian = big
 
image_format = ?
==Identifying GIM settings by reading GIM structure==
pixel_order = ?
GIM format is not completly documented, allows for lot of features that generates different GIM structures, at this point is not posible to identify all this GIM formats, for more info see: [[Graphic Image Map (GIM)]]
pixel_channel = ?
*The most important settings needed to collect from the original GIM file are:
pixel_alpha = ?
**'''format_endian''' (offset 0 in the GIM)
}
**'''format_style'''  (offset 8 in the GIM)
</syntaxhighlight>}}
**'''image_format''' (offset 4 at block 4 in the GIM)
**'''pixel_order''' (offset 6 at block 4 in the GIM)
 
*Some notes:
**GIM files using image formats with indexed colors have an additional block 5, and block 4 is displaced
**The list of settings mentioned above will work '''only''' if the GIM contains a single image/level/frame, otherway the GIM structure becomes more complex
**There are 4 unknown fields in GIM structure, and it seems GIM was used in other unknown sony devices or tools, so dont take this as something general, is just an approach focused in PS3 and PSP
 
For this reasons, identifying GIM settings by reading GIM structure is not 100% accurate (there are too much unknown features and room for errors), the way to identify GIM settings more accuratelly is the next method explained... by bruteforce
 
==Identifying GIM settings by bruteforce==
{{Boxinfo1|content='''GIM-to-GIM''' is the only conversion method that is '''[https://en.wikipedia.org/wiki/Lossless_compression lossless]''' for all image formats supported by GimConv.exe}}
The word [https://en.wikipedia.org/wiki/Brute-force_search bruteforce] sounds a bit ridiculous when used to identify image settings but defines pretty well how this identification method works. Consist in rebuilding the original GIM file several times by using different GimConv settings until we generate a GIM file identical to the original. In other words... if you find how to create a GIM file exactly like the original you can be 100% sure the GIM settings you are using are exactly the same used by sony to create that GIM


=How to identify GIM settings=
The only way to create a GIM file exactly like the original (that works with all image formats) is by making a GIM-to-GIM conversion, GimConv rebuilds the file when doing a GIM-to-GIM conversion and in the conversion is preserved the pixel data of dxt based image formats, otherway if the GIM image is dxt based and you try to convert it to other format (such PNG) and back to dxt it will never be like the original because dxt conversions are [https://en.wikipedia.org/wiki/Lossy_data_conversion lossy]


*GIM--->GIM method (prefered)
For bruteforce is used a "dictionary" that contains the posible "candidates" to solve the "problem", our dictionary (with the GIM formats found in PS3) only contains 3 candidates, this means in the worst scenario is need to rebuild the GIM file a max of 3 times. If none of the 3 GIM files matches with the original we have a problem (please report back and we will add the rare format to this wiki page)
**Use gimconv with .gim files as input and output (this preserves dxt pixel info, because dxt images doesnt suffers a conversion)
{{Keyboard|content='''gimconv.exe test.gim -o test.gim --format_style psp --format_endian big --image_format dxt5 --pixel_channel default --pixel_alpha default'''}}


*GIM--->PNG--->GIM method (fails when there is involved a DXT conversion because DXT conversions are lossy, works fine for rgba**** image formats):
'''1st most common'''
**Use rcomagegui to make an extraction of the contents '''without''' conversion of images (this way the GIM are extracted as GIM)
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe original.gim -o try1.gim -ps3rgba8888</syntaxhighlight>}}
**Use rcomagegui to make another extraction of the contents '''with''' conversion of images (this way the GIM are extracted as PNG)
'''2nd most common''' (this is a variant of the previous with <abbr title="the block contains info related with the GIM creation and a version usually 'GimConv 1.20e' in retail PS3 firmwares, when you run this command the original block data is preserved but the version is updated">a block added at the end of the file</abbr>)
**Use gimconv to convert a PNG ---to---> GIM by the old method of test-error by trying some of the options availables that appears in gimonv.cfg
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe original.gim -o try2.gim -ps3rgba8888 --update_fileinfo on</syntaxhighlight>}}
**Use a hexeditor to compare the original GIM extracted in step 1 with the rebuilt GIM from your test, there is no need to make accurate comparisons, just an overview of the first 0x80 bytes of the header, and how the pixel data is ordered starting at offset 0x80
'''3rd most common'''
**When the header and pixel data seems similar make a hash comparison, original GIM and rebuild GIM should be exactly the same hash (is posible to create a GIM exactly like the original)
{{Keyboard|content=<syntaxhighlight lang="bash">gimconv.exe original.gim -o try3.gim -dxt5</syntaxhighlight>}}


*By using GimConv.exe with the '''-S''' option
After every GIM-to-GIM conversion is needed to compare the hashes, first "original.gim VS try1.gim", then "original.gim VS try2.gim", then "original.gim VS try3.gim"
**This generates a .GIS file (is a text based file that contains info about the .GIM file, included all the pixel data)
{{Keyboard|content='''GimConv\GimConv.exe -S test.gim -o test.gis'''}}


=GIM formats used in PS3=
===GimConv.exe version patch===
PS3 uses at least 2 types of GIM images, both included inside rco's, and in some cases both types in the same rco
The reason to use this patch is because by enabling the setting '''--update_fileinfo on''' is added a block of data (named "fileinfo" with block id 0x00FF) at bottom of the GIM file, in a GIM-to-GIM conversion this block of data (from the original.gim) is preserved (added in the rebuild GIM file) but the GimConv version included at the end of this block is updated. The GimConv versions in the original PS3 retail GIM files are '''GimConv 1.20e''' and when you do the GIM-to-GIM conversion it changes to '''GimConv 1.20h''', the difference is a single byte but doesnt allows to create a GIM file identical to the original (the hash check fails, and this sucks). If you are using some external code you can modify this byte by other means (so you dont need to use this patch for GimConv.exe) but for normal usage of GimConv.exe in command line this patch is handy because it allows to create identical GIM files


When an .RCO contains 2 or more images that was created with different .GIM settings... it means is not posible to compile the .RCO with rcomage by using .PNG images as source (because rcomage.exe sends the GIM settings to gimconv.exe to make the PNG--->GIM image conversion and this settings are applyed to all PNG images)
GimConv.exe v1.20h original (MD5:425B2E4D9684BCE1FC79A37247618AC8)
At offset 0x91E4 replace 0x68 by 0x65 (character 'h' by character 'e')
At offset 0x91F8 replace 0x68 by 0x65 (character 'h' by character 'e')
GimConv.exe v1.20h patched to v1.20e (MD5:6C9B0E47273EFA6D34121A46E65EEDC6)


In other words, the only way to compile this RCO's is in 2 steps. In the first step is needed to make the different .GIM conversions with gimconv.exe (and all the other conversions in case exists .VAG audio a WAV2VAG conversion or a JS2VSMX for the .VSMX script). In the second step is needed to compile the .RCO with rcomage.exe by using the .GIM's .VAG's and .VSMX's as sources without any kind of file conversions
As far i know all the GIM files from PS3 retail firmwares that was created using '''--update_fileinfo on''' was build with GimConv.exe v1.20'''e''', and the patch changes the GimConv.exe version from v1.20'''h''' (the public GimConv.exe) by v1.20'''e''' (the internal GimConv.exe not available for us), so it should work for most GIM files... if at some point someone finds other GIM files that was made with other GimConv.exe versions (c, d, f, g) and you want to use this bruteforce identification process you can make others GimConv.exe patched with different versions and rename them to GimConvC.exe, GimConvD.exe, GimConvE.exe, GimConvF.exe, GimConvG.exe etc... and keep all them in the same folder next to the original v1.20h


Also means we have a big problem to document in wiki wich settings are used for each image (there are thousands of images so initially seems not posible), but probably they follows a rule, so the solution is to deduce or imagine the real reason of why the ps3 is using different gim formats inside the .rco's
==Examples==
*In [[explore_plugin]]_full.rco from firmware 4.70 there are 245 images:
**201 was created by using settings: ''--format_style psp --format_endian big --image_format rgba8888 --pixel_order normal'' (exact match of gims after rebuilding gim--->png--->gim), such tex_psn.gim
**030 was created by using settings: ''--format_style psp --format_endian big --image_format rgba8888 --pixel_order normal --update_fileinfo on'' (exact match of gims after removing footer from originals and rebuilding gim--->png--->gim), see: [[Graphic_Image_Map_(GIM)#0xFF_.28Fileinfo.29|fileinfo]]:
**014 was created by using settings: ''--format_style psp --format_endian big --image_format dxt5'' (exact match of gims after rebuilding gim--->gim)
***item_tex_trophy.gim, trophy_tex_grade_bronze.gim, trophy_tex_grade_gold.gim, trophy_tex_grade_hidden.gim, trophy_tex_grade_platinum.gim, trophy_tex_grade_silver.gim, item_tex_CardBallon.gim, item_tex_Profile_Game.gim, item_tex_Profile_Highlight.gim, item_tex_Profile_Onlines.gim, tex_indi_Me.gim, tex_sb_base.gim, tex_sb_base_s.gim, tex_sb_slider.gim


<!--
{| class="wikitable"
{| class="wikitable"
|-
|-
! image group or rco !! gim settings !! notes
! image group or rco !! gim settings !! notes
|-
|-
| '''ps3bpp32''' || --format_style psp --format_endian big --image_format rgba8888 --pixel_order normal || Most used GIM format inside .rco's
| '''ps3rgba8888''' || --format_style psp --format_endian big --image_format rgba8888 --pixel_order normal || Most used GIM format inside .rco's
|-
|-
| '''ps3dxt5''' || --format_style psp --format_endian big --image_format dxt5 || Second most used GIM format inside rco's
| '''ps3dxt5''' || --format_style psp --format_endian big --image_format dxt5 || Second most used GIM format inside rco's
|}
|}
-->


'''Notes about [[explore_plugin]]_full.rco from firmware 4.70''':
<!--
*There are 245 images
*This ones are perfect candidates to use for examples of how to find the correct GIM settings, all them located inside '''[[explore_plugin]]_full.rco'''
**201 was created by using options: ''--format_style psp --format_endian big --image_format rgba8888 --pixel_order normal'' (exact match of gims after rebuilding gim--->png--->gim)
**'''item_tex_NewUser.gim''' (rgba8888 without fileinfo)
**030 was created by using options: ''--format_style psp --format_endian big --image_format rgba8888 --pixel_order normal --update_fileinfo on'' (exact match of gims after removing footer from originals and rebuilding gim--->png--->gim)
**'''item_tex_NewFriend.gim''' (rgba8888 with fileinfo)
**014 was created by using options: ''--format_style psp --format_endian big --image_format dxt5'' (exact match of gims after rebuilding gim--->gim)
**'''item_tex_trophy.gim''' (dxt5 without fileinfo)
***item_tex_trophy.gim, trophy_tex_grade_bronze.gim, trophy_tex_grade_gold.gim, trophy_tex_grade_hidden.gim, trophy_tex_grade_platinum.gim, trophy_tex_grade_silver.gim, item_tex_CardBallon.gim, item_tex_Profile_Game.gim, item_tex_Profile_Highlight.gim, item_tex_Profile_Onlines.gim, tex_indi_Me.gim, tex_sb_base.gim, tex_sb_base_s.gim, tex_sb_slider.gim
-->
 
This is the footer of item_tex_cam_icon.gim (was added to the gim by enabling '''update_fileinfo''' option, variable size)
'''Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F'''
00006AD0  00 FF 00 00 00 00 00 4C 00 00 00 4C 00 00 00 10  .ÿ.....L...L....
00006AE0  53 70 61 6E 61 2E 74 67 61 00 73 30 30 30 39 33  Spana.tga.s00093
00006AF0  37 00 53 75 6E 20 41 70 72 20 32 33 20 31 38 3A  7.Sun Apr 23 18:
00006B00  33 39 3A 34 38 20 32 30 30 36 00 47 69 6D 43 6F  39:48 2006.GimCo
00006B10  6E 76 20 31 2E 32 30 65 00 00 00 00              nv 1.20e....
 
And this is the footer of a rebuild gim where the footer was added in the rebuild process
'''Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F'''
00002300  00 FF 00 00 00 00 00 54 00 00 00 54 00 00 00 10  .ÿ.....T...T....
00002310  74 65 78 5F 70 73 6E 2E 70 6E 67 00 41 64 6D 69  tex_psn.png.Admi
00002320  6E 69 73 74 72 61 64 6F 72 00 53 61 74 20 4D 61  nistrador.Sat Ma
00002330  72 20 30 37 20 30 31 3A 33 32 3A 30 31 20 32 30  r 07 01:32:01 20
00002340  31 35 00 47 69 6D 43 6F 6E 76 20 31 2E 32 30 68  15.GimConv 1.20h
00002350  00 00 00 00                                      ....
 
It seems the reason why this images are slighty different is because are ancient (has not been updated lot of firmwares ago, and uses the format from the first firmwares)
 
As interesting details, in the footer of original files it can be seen the name and format of the original image (.tga), the windows user name, timestamp (from 2006), an the version of GimConv (an old 1.20e)
 
The '''00 00 00 4C''' (repeated 2 times) at top of the footer in the original gim example is the size of the whole footer (usefull to make the calculation to remove the footer and update the filesize at gim header)
 
==Speculation==
Initially... it seems the gim format depends of who is the responsible of displaying them (as an example, in the link above it seems the images reported as "rare" belongs to "tex_indi_***" (are textures for the "indicator", is the information bar at top-right of xmb, are the tiny icons that appears eventually when you receive a message, etc..)
 
<strike>Note is posible to group them based in how his names starts, all "tex_indi" belongs to indicator so should share the same gim format, even if there are more "tex_indi" inside other rco's, doesnt matters in wich .rco are located what matters is his purpose is the same (to be displayed inside the indicator)</strike> This assumption seems wrong
 
{{File Formats}}
{{File Formats}}
<noinclude>[[Category:Main]]</noinclude>
<noinclude>[[Category:Main]]</noinclude>

Latest revision as of 20:31, 15 September 2021

Description[edit | edit source]

GimConv.exe is a sony program for microsoft windows used to convert GIM images, see Graphic Image Map (GIM)

  • GimConv.exe versions:
    • 1.20c (it can be seen in the fileinfo block of GIM images with timestamp from november 2005, since firmware 0.82.006)
    • 1.20d (it can be seen in the fileinfo block of GIM images with timestamp from march 2006, since firmware 0.85.007)
    • 1.20e (it can be seen in the fileinfo block of GIM images with timestamp from april 2006, since firmware 0.85.007 and still present in PS3 4.82 firmware)
    • 1.20h released with p3tcompiler v2.00 as part of the PS3 Custom Theme Toolbox (this is the version included in rcomage using a modifyed GimConv.cfg)
  • Other notes:
    • GIM images can be previewed in PC by using Gim Viewer (unnofficial app made by hsreina, it has limited support for the "rgba based" GIM formats). See Multimedia Formats and Tools
    • The option -viewer (start gimview.exe when process ends) in the official config file (that was removed for rcomage) is intended to launch an official gimview.exe that doesnt exists in the public release
    • PSP Custom Theme Toolbox admits GIM files as inputs, but doesnt includes an standalone GIM converter
    • Some of the settings (such merge_mode) seems to be related with animated images but the support of animated GIM images on PlayStation consoles is unknown, see: talk
    • Supports AVI video as input, converts the video frames to static images and build a multiframe GIM with them
    • Supports an internal script format to automatize image conversions, there is one script definition located at bottom of Gimconv.cfg named "Filter". The usage of this scripting features is unknown
    • It uses an intermediate format named GIS that seems to be related with the scripting features
    • There is a GIS2PNG converter made by TizzyT

GimConv.cfg Overview[edit | edit source]

Before explaining how GimConv.exe works is needed an introduction about GimConv.cfg (the config file). All features of GimConv.exe are driven by the settings that appears on GimConv.cfg

The contents of GimConv.cfg are loaded "from top to bottom" first are loaded the default settings, and then the settings inside the option (incase you enable some option/s, otherway the options are ignored). When enabled, the settings inside the options (at bottom ofGimConv.cfg) are going to "override" the default settings (at top of GimConv.cfg), this overriding also happens with any setting or option you use in command line, as example, if you change the same setting 3 times in a single command line the only setting that counts is the last one

usage {
        This is the help screen (only informative)
}
default {
        Default predefined settings (loaded "from top to bottom", if a setting is repeated two or more times the most at bottom overrides the other/s at top)
}
input * {
        Settings for input file formats
}
option * {
        Groups of settings (overrides the defaults settings, are only used when you specify the option name at the command line)
}
script * {
        Unknown
}

Below is shown GimConv.cfg released by sony as part of the PS3 Custom Theme Toolbox (official version)

GimConv.cfg (original)
Edit-copy purple.svg.png
//================================================================
//  gimconv configuration
//================================================================

usage {
	puts "usage:"
	puts "        gimconv <input files> [options]"
	puts ""
	puts "options:"
	puts "        -interact       input additional options"
	puts "        -pictures       merge files as pictures"
	puts "        -frames         merge files as frames"
	puts "        -levels         merge files as levels"
	puts "        -prompt         prompt always"
	puts "        -warning        prompt on warning"
	puts "        -error          prompt on error"
	puts "        -viewer         start gimview.exe when process ends"
	puts "        -o <filename>   specify output file name"
	puts "        -s <w,h>        resize image data"
	puts "        -S              output text format"
	puts "        -P              resize image data to a power of two"
	puts "        -N              output in normal pixel storage format"
	puts "        -F              output in faster pixel storage format"
	puts "        -R              re-convert ( don't swap RGBA <-> ABGR )"
}

//----------------------------------------------------------------
//  default settings
//----------------------------------------------------------------

default {
	load "lib/*"

	//  main control

	interact_mode = off		// off on ctrl
	merge_mode = off		// off picture frame level plane
					// image palette sequence
	prompt_mode = off		// off on warning error
	output_object = on		// off on
	output_script = off		// off on
	output_directory = auto		// current input auto
	output_filename = ""
	object_extension = .gim
	script_extension = .gis
	userdata_extension = .dat
	glob_extension = .dds .tm2 .tga .bmp .avi
	object_viewer = ""

	//  process control

	filter_script = "Filter"
	image_size = default		// default pow2 $w,$h
	pixel_order = default		// default normal faster
	pixel_alpha = default		// default $alpha
	pixel_channel = default		// default rgba rgab ragb ... etc
	image_format = default		// default rgba8888 rgba4444 rgba5551 rgba5650
					// index4 index8 index16 index32
					// dxt1 dxt3 dxt5 dxt1ext dxt3ext dxt5ext
	palette_format = default	// default rgba8888 rgba4444 rgba5551 rgba5650
	update_userdata = default	// default off on
	update_fileinfo = off		// default off on

	check_limit = on		// off on
	limit_image_width = 4096	// off $count
	limit_image_height = 4096	// off $count
	limit_level_count = 8		// off $count
	limit_frame_count = off		// off $count

	//  output control

	format_style = psp		// std psp ps3
	format_endian = little		// little big

	output_image = on		// off on
	output_palette = on		// off on
	output_sequence = on		// off on

	//  PS3 OSD default settings

	format_endian = big		// -B
	pixel_order = normal		// -N
	pixel_channel = default		// -R
	image_format = rgba8888		// --image_format rgba8888

	extend_edge = off
}

//--------------------------------------------------------
//  format specific
//--------------------------------------------------------

input *.avi {
	pixel_alpha = 255
}

input *.bmp {
	pixel_alpha = 255
}

input *.dds {
}

input *.tga {
}

input *.tm2 {
}

input *.gim {
}

input *.gis {
}

//--------------------------------------------------------
//  mode option
//--------------------------------------------------------

option -interact {
	interact_mode = on
}

option -pictures {
	merge_mode = picture
}

option -frames {
	merge_mode = frame
}

option -levels {
	merge_mode = level
}

option -planes {
	merge_mode = plane
}

option -images {
	merge_mode = image
}

option -palettes {
	merge_mode = palette
}

option -sequences {
	merge_mode = sequence
}

option -prompt {
	prompt_mode = on
}

option -warning {
	prompt_mode = warning
}

option -error {
	prompt_mode = error
}

option -viewer {
	object_viewer = "GimView.exe"
}

//--------------------------------------------------------
//  process option
//--------------------------------------------------------

option -o %filename {
	output_filename = %filename
}

option -s %size {
	image_size = %size
}

option -g %ext {
	glob_extension = %ext
}

option -P {
	image_size = pow2
}

option -N {
	pixel_order = normal
}

option -F {
	pixel_order = faster
}

//--------------------------------------------------------
//  PS3 OSD specific options
//--------------------------------------------------------

option -B {
	format_endian = big
}

option -X {
	pixel_channel = abgr
}

option -R {
	pixel_channel = default
}

option -DXT {
	pixel_order = default
	pixel_channel = default
	image_format = default
}

option -E {
	extend_edge = on
}

//--------------------------------------------------------
//  output option
//--------------------------------------------------------

option -S {
	output_object = off
	output_script = on
}

//--------------------------------------------------------
//  filter script
//--------------------------------------------------------

script Filter %target {
	RescaleImage   %target $image_size
	SetPixelFormat %target $image_format $palette_format
	SetPixelAlpha  %target $pixel_alpha
	SwapPixelChannel %target $pixel_channel
	ConfigureImage %target order $pixel_order
	UpdateUserData %target $update_userdata
	UpdateFileInfo %target $update_fileinfo
	ExtendEdge     %target $extend_edge
	CheckPSP       %target $check_limit
}

The config file released with Rcomage have some default settings modifyed that are problematic for PS3 compatibility. For more info about the modifications made in the config file released with rcomage see the differences in the Discussion page

GimConv.exe usage[edit | edit source]

Help screen[edit | edit source]

The help screen of GimConv.exe displays a few options with an small explain about them, the example below belongs to the official GimConv.cfg with the options sony considered useful, this options are mostly useless for us, in short: interact doesnt allows to do special things, the merge modes are hardcore because are intended to create GIM files by some kind of artisan method where you create the GIM by using "pieces" from other files, the promt modes doesnt helps much, gimview.exe doesnt exists, the image resize methods should not be used (instead you should prepare your images with the correct size before converting them with GimConv.exe), the pixel formats normal/faster should not be used that way individually, and the options to swap rgba color channels are not needed for PS3

Type This
C:\PS3_Custom_Theme_v200\GimConv>GimConv.exe
gimconv ver 1.20h --- generic picture converter
 Copyright (C) 2006 Sony Computer Entertainment Inc.
  All Rights Reserved.

usage:
        gimconv <input files> [options]

options:
        -interact       input additional options
        -pictures       merge files as pictures
        -frames         merge files as frames
        -levels         merge files as levels
        -prompt         prompt always
        -warning        prompt on warning
        -error          prompt on error
        -viewer         start gimview.exe when process ends
        -o <filename>   specify output file name
        -s <w,h>        resize image data
        -S              output text format
        -P              resize image data to a power of two
        -N              output in normal pixel storage format
        -F              output in faster pixel storage format
        -R              re-convert ( don't swap RGBA <-> ABGR )

Options[edit | edit source]

Tip
To specify an option is needed to use a single dash with the name of the option.

GimConv.exe allows to make a GIM-to-PNG conversion by specifying the file extension with the option -o:

Type This
gimconv.exe in.gim -o out.png

If you make a PNG-to-GIM conversion (or any of the supported input formats to GIM) without specifying any other option then are going to be loaded all the default settings of GimConv.cfg (from top to bottom) and this is not good because you dont have much control of the resulting GIM, most probably is going to generate a GIM file not compatible with PS3, at this point maybe you thought in creating a modifyed GimConv.cfg with all the default settings required by PS3 but this is not good enought either because there are (at least) 2 different GIM formats used in PS3 and you are going to break the compatbility with PSP, anyway here is the command as an usage example

Type This
gimconv.exe in.png -o out.gim

The interesting options are located at middle of GimConv.exe and contains several settings, this is an example of an option that is overriding the most critical settings (is a bit pointless thought, because the settings are given the value "default")

Type This
gimconv.exe in.png -o out.gim -DXT

The option -DXT used in this example contains 3 settings that are going to be loaded after the default settings (this is an example of the official GimConv.cfg, the one used inside rcomage is different):

option -DXT {
	pixel_order = default
	pixel_channel = default
	image_format = default
}

Another example where can be seen better how the options contains settings that overrides the default settings:

Type This
gimconv.exe in.gim -o out.gis -S
  • The option -S contains this settings:
option -S {
	output_object = off
	output_script = on
}

At top of GimConv.cfg (as part of the default settings) appears the settings: output_object with value on and output_script with value off (so by default gimconv.exe outputs a GIM and doesnt outputs a GIS). The option -S of this example is switching them (doesnt outputs a GIM but it outputs a GIS)

Settings[edit | edit source]

Tip
To specify a setting is needed to use a double dash with the name of the setting.

This is the most accurate way to have full controll of the GIM settings, if you are picky you can write a long line of settings to override all the critical default settings (just incase the GimConv.cfg was modifyed by someone, by doing this you are overriding his/her changes made to the default settings). If you are writing an script or any tool that sends actions to gimconv.exe you should use this method

Type This
gimconv.exe in.png -o out.gim --pixel_order normal --format_style psp --format_endian big

The 3 settings in the example are overriding the default settings at top of GimConv.cfg (this is an example of the official GimConv.cfg, the one used inside rcomage is different):

//----------------------------------------------------------------
//  default settings
//----------------------------------------------------------------
	pixel_order = default		// default normal faster
	format_style = psp		// std psp ps3
	format_endian = little		// little big

Cumulative options and settings[edit | edit source]

Tip
Reminder: options are passed with a single dash and settings with a double dash

This is the official way, the predefined options of the official GimConv.cfg are intended to be used together with other options, this way you can have an option containing a group of settings (that are common for a console) and several other options for the different GIM formats supported in that console, using GimConv.exe this way is a bit more confusing though and makes harder to pass commands to it, but is very handy to make tests

Type This
gimconv.exe in.png -o out.gim -DXT --pixel_channel brag

The command in the example is loading the option -DXT like in the example above, but additionally is overriding one of the settings inside -DXT with the --pixel_channel brag to reorder the color channels (from left to right, BLUE, RED, ALPHA, GREEN), the resulting GIM is going to be like the one made in the example above, the only difference is the location of the pixel colors

It allows to cummulate many options and settings in any order (be careful this could create some problems) to do something like this:

Type This
gimconv.exe in.png -o out.gis -DXT --pixel_channel brag -S

From rcomage[edit | edit source]

Warning
Warning
Dont use this method for PS3. GIM files from PS3 firmware uses (at least) 2 different GIM formats, rcomage applyes the same settings for all the GIM files so some are broken

This ones are rcomage commands that includes gimconv commands in between quotes, are optional and are intended to change the default GIM settings used by rcomage when doing the PNG-to-GIM conversions. Rcomage.exe sends the GIM settings to gimconv.exe when is compiling the RCO (see the "compile" help in rcomage page). There are 2 options in rcomage specific for this task, named: --gimconv-cmd and --gimconv-flags

Type This
rcomage.exe compile in.xml out.rco --gimconv-cmd ".\gimconv\gimconv.exe" --gimconv-flags "--pixel_order normal --format_style psp --format_endian big"

As mentioned here inside RCO files from PS3 official firmwares there are (at least) 2 types of GIM formats, and usually both are used inside the same RCO, as example... an RCO with a total of 14 GIM files where 12 of them was made using some GIM settings, and the other 2 with different GIM settings, for this reason is needed to identify the GIM settings and rebuild every GIM file individually

Is not posible to compile a PS3 RCO with rcomage by using PNG images as source (either way, using the commands in the example above or not using them, the problem is the same) because the GIM settings sent by rcomage are applyed to all the PNG images, so all the GIM files in the RCO will have the same GIM settings, this doesnt works for PS3 GIM files !

How to rebuild a PS3 RCO with custom GIM images using Rcomage and GimConv
  1. - Extract RCO. Use Rcomage.exe to dump the RCO contents without image conversions (so GIM files are extracted as GIM) to a folder named RebuildMe. This files are going to be used to identify the original GIM setting and for RCO rebuilding purposes
  2. - GIM to PNG. Identify visually the image you want to customize by converting it to PNG. For this example the image is named icon.png. The conversion to PNG can be made by two optional ways:
    1. - Use Rcomage.exe to extract the RCO contents with image conversions (so GIM files are extracted and converted to PNG) to a folder named DontRebuildMe. This files cant be used for RCO rebuilding purposes
    2. - Or use GimConv.exe to convert the original icon.gim (from RebuildMe folder) to icon.png with the command: "gimconv.exe icon.gim -o icon.png"
  3. - Custom PNG. Use icon.png as the base (mostly to respect the original width and height) and customize it with any image edition program (gimp, photoshop, etc...)
  4. - Identify GIM settings. Use GimConv.exe to identify the original GIM settings of icon.gim (from RebuildMe folder) by making GIM-to-GIM conversions
  5. - PNG to GIM. Use GimConv.exe to convert the custom icon.png to icon.gim with the GIM settings you found in step 4
  6. - Overwrite original GIM. Copy the custom icon.gim to RebuildMe folder overwriting the original icon.gim (this is the only file modifyed in RebuildMe folder along all this explain)
  7. - Build RCO. Use Rcomage.exe to compile the RCO with the files from RebuildMe folder


GimConv.cfg options for PS3[edit | edit source]

You can modify the GimConv.cfg file by adding some options (with custom names) containing any settings, by doing this you can keep a record of the correct settings for some GIM formats and group lot of settings under a single option, additionally when using GimConv.exe from command line the commands will be much shorter. This wiki section proposes a couple of options (but probably PS3 supports a lot more) that have been tested and are the first and second most commonlly used in PS3 official firmwares

  • 1st most common GIM format used in official PS3 firmwares
option -ps3rgba8888 {
	format_endian = big
	format_style = psp
	image_format = rgba8888
	pixel_order = normal
	pixel_channel = rgba
	limit_image_width = 4096
	limit_image_height = 4096
}
  • 2nd most common GIM format used in official PS3 firmwares
option -ps3dxt5 {
	format_endian = big
	format_style = psp
	image_format = dxt5
	pixel_order = normal
	pixel_channel = default
	limit_image_width = 4096
	limit_image_height = 4096
}

How to identify GIM settings[edit | edit source]

The goal is to identify the GimConv settings that was used when the original GIM file was created, there are basically two ways to identify GIM settings, by reading the GIM structure, or by bruteforce

Both identification methods can be made manually or by using external code, and are not exclusive. For code performance reading the GIM structure is faster, but for accuracy the bruteforce method is 100% accurate, so a code could start reading "what we know" from the GIM structure and then start with the bruteforce to get the confirmation

Identifying GIM settings by reading GIM structure[edit | edit source]

GIM format is not completly documented, allows for lot of features that generates different GIM structures, at this point is not posible to identify all this GIM formats, for more info see: Graphic Image Map (GIM)

  • The most important settings needed to collect from the original GIM file are:
    • format_endian (offset 0 in the GIM)
    • format_style (offset 8 in the GIM)
    • image_format (offset 4 at block 4 in the GIM)
    • pixel_order (offset 6 at block 4 in the GIM)
  • Some notes:
    • GIM files using image formats with indexed colors have an additional block 5, and block 4 is displaced
    • The list of settings mentioned above will work only if the GIM contains a single image/level/frame, otherway the GIM structure becomes more complex
    • There are 4 unknown fields in GIM structure, and it seems GIM was used in other unknown sony devices or tools, so dont take this as something general, is just an approach focused in PS3 and PSP

For this reasons, identifying GIM settings by reading GIM structure is not 100% accurate (there are too much unknown features and room for errors), the way to identify GIM settings more accuratelly is the next method explained... by bruteforce

Identifying GIM settings by bruteforce[edit | edit source]

Info
GIM-to-GIM is the only conversion method that is lossless for all image formats supported by GimConv.exe

The word bruteforce sounds a bit ridiculous when used to identify image settings but defines pretty well how this identification method works. Consist in rebuilding the original GIM file several times by using different GimConv settings until we generate a GIM file identical to the original. In other words... if you find how to create a GIM file exactly like the original you can be 100% sure the GIM settings you are using are exactly the same used by sony to create that GIM

The only way to create a GIM file exactly like the original (that works with all image formats) is by making a GIM-to-GIM conversion, GimConv rebuilds the file when doing a GIM-to-GIM conversion and in the conversion is preserved the pixel data of dxt based image formats, otherway if the GIM image is dxt based and you try to convert it to other format (such PNG) and back to dxt it will never be like the original because dxt conversions are lossy

For bruteforce is used a "dictionary" that contains the posible "candidates" to solve the "problem", our dictionary (with the GIM formats found in PS3) only contains 3 candidates, this means in the worst scenario is need to rebuild the GIM file a max of 3 times. If none of the 3 GIM files matches with the original we have a problem (please report back and we will add the rare format to this wiki page)

1st most common

Type This
gimconv.exe original.gim -o try1.gim -ps3rgba8888

2nd most common (this is a variant of the previous with a block added at the end of the file)

Type This
gimconv.exe original.gim -o try2.gim -ps3rgba8888 --update_fileinfo on

3rd most common

Type This
gimconv.exe original.gim -o try3.gim -dxt5

After every GIM-to-GIM conversion is needed to compare the hashes, first "original.gim VS try1.gim", then "original.gim VS try2.gim", then "original.gim VS try3.gim"

GimConv.exe version patch[edit | edit source]

The reason to use this patch is because by enabling the setting --update_fileinfo on is added a block of data (named "fileinfo" with block id 0x00FF) at bottom of the GIM file, in a GIM-to-GIM conversion this block of data (from the original.gim) is preserved (added in the rebuild GIM file) but the GimConv version included at the end of this block is updated. The GimConv versions in the original PS3 retail GIM files are GimConv 1.20e and when you do the GIM-to-GIM conversion it changes to GimConv 1.20h, the difference is a single byte but doesnt allows to create a GIM file identical to the original (the hash check fails, and this sucks). If you are using some external code you can modify this byte by other means (so you dont need to use this patch for GimConv.exe) but for normal usage of GimConv.exe in command line this patch is handy because it allows to create identical GIM files

GimConv.exe v1.20h original (MD5:425B2E4D9684BCE1FC79A37247618AC8)
At offset 0x91E4 replace 0x68 by 0x65 (character 'h' by character 'e')
At offset 0x91F8 replace 0x68 by 0x65 (character 'h' by character 'e')
GimConv.exe v1.20h patched to v1.20e (MD5:6C9B0E47273EFA6D34121A46E65EEDC6)

As far i know all the GIM files from PS3 retail firmwares that was created using --update_fileinfo on was build with GimConv.exe v1.20e, and the patch changes the GimConv.exe version from v1.20h (the public GimConv.exe) by v1.20e (the internal GimConv.exe not available for us), so it should work for most GIM files... if at some point someone finds other GIM files that was made with other GimConv.exe versions (c, d, f, g) and you want to use this bruteforce identification process you can make others GimConv.exe patched with different versions and rename them to GimConvC.exe, GimConvD.exe, GimConvE.exe, GimConvF.exe, GimConvG.exe etc... and keep all them in the same folder next to the original v1.20h

Examples[edit | edit source]

  • In explore_plugin_full.rco from firmware 4.70 there are 245 images:
    • 201 was created by using settings: --format_style psp --format_endian big --image_format rgba8888 --pixel_order normal (exact match of gims after rebuilding gim--->png--->gim), such tex_psn.gim
    • 030 was created by using settings: --format_style psp --format_endian big --image_format rgba8888 --pixel_order normal --update_fileinfo on (exact match of gims after removing footer from originals and rebuilding gim--->png--->gim), see: fileinfo:
    • 014 was created by using settings: --format_style psp --format_endian big --image_format dxt5 (exact match of gims after rebuilding gim--->gim)
      • item_tex_trophy.gim, trophy_tex_grade_bronze.gim, trophy_tex_grade_gold.gim, trophy_tex_grade_hidden.gim, trophy_tex_grade_platinum.gim, trophy_tex_grade_silver.gim, item_tex_CardBallon.gim, item_tex_Profile_Game.gim, item_tex_Profile_Highlight.gim, item_tex_Profile_Onlines.gim, tex_indi_Me.gim, tex_sb_base.gim, tex_sb_base_s.gim, tex_sb_slider.gim