Posted: Thu May 26, 2016 3:34 pm Post subject:
BatchTMPConverter
Subject description: Command-line tool for converting TMP's.
BatchTMPConverter is a command-line tool for replacing tile image data on Command & Conquer Tiberian Sun / Red Alert 2 terrain template (tmp) files. It allows for fast and quick conversion of PNG image files into already existing terrain templates, or vice-versa, exporting PNG images from existing terrain template files.
It works by looking for tmp files from input/files directories filtered by file extensions, and looking for a PNG image file matching the filename of the template (sans extension, of course). Only 32-, 24- and 8-bit images are supported as of current, with 8-bit images retaining their own palette information. Image dimensions have to match the full size of the template for the tool to attempt conversion. Image output mode (-o) does the reverse and exports 24-bit PNG images from the terrain template files, overwriting files with same filename.
-h | Show help.
-i= | A comma-separated list of input tmp file(s) and/or directory/directories.
-p= | Palette file to use for conversion.
-o | Output template data as images instead of converting images to templates.
-e= | Comma-separated list of file extensions (including the .) to use instead of built-in defaults.
-r | Alter tile radar colors based on new image & palette data.
-m= | Multiplier to radar color RGB values, if they are altered.
-x | Allow overwriting background color pixels on existing extra images.
-b | Disable backing up the edited files with same name using file extension .old.
-l | Write log info to file as well as console.
Special Thanks:
To Olaf van der Spek for his documentation on TS/RA2 TMP file format.
Changelog:
Version 3.0.0
• Improved palette color matching, should come with slightly more accuracy under certain conditions and much faster runtime in exchange for somewhat increased memory consumption.
• Extra image data overlapping regular tile data is now clipped accordingly.
• Command-line argument -x can now be used to enable overwriting background color pixels in extra image data.
• Command-line argument -l can now be used to enable logging to file.
Version 2.0.0
• Added image export from template mode which can be enabled by using command line parameter -o.
• Now requires .NET Framework 4.0 instead of 2.0.
Version 1.0.1
• Silhouette of existing extra images is now respected and no pixels will be drawn on background color.
• Tool will now correctly draw background color over existing tile image data (except extra images) where needed. _________________ Last edited by Starkku on Sat Jul 04, 2020 7:01 pm; edited 11 times in total QUICK_EDIT
If you can show me that this has some effect on the display of tiles in the game, I will attempt to change it to work like XCC's but otherwise I will not bother. _________________ QUICK_EDIT
I don't think it will have any impact in-game except may be rendering some non-transparent pixels twice. But
I just checked it with just this one tile only and that too not in-game. Just saw the difference, so reported it. QUICK_EDIT
The doubled image on the extra graphics could cause trouble when rendering stuff that stands on this tile, causing the image in the high render layer extra graphic to be shown in front of the object. _________________ SHP Artist of Twisted Insurrection: Nod buildings
When using the "paste complete" option in TMP Editor it will only apply the new image to pre-existing, non 0 colour pixels. If you use "paste extra image" then it will copy the whole image like in Starkku's program.
As LKO said it can cause problems & would need to be manually clipped or the Z-data lowered. However the majority of tiles using extra images aren't accessible to units, so the overlapping would be minimal.
It's a nice tool but for my workflow it would take just as long to save each tile as a PNG as it would to just copy it into TMP Editor. If you are just recolouring the original tiles tho I can see this as being a quick & easy way to do it. _________________
Exe has been updated but there is no update post, so assuming it is still WIP:
- If the new image is smaller than in the template, it retains the old surplus portions.
- Problem with RA2 cliff08.tem, the resulting tem file had distorted image even with its own exported
image. Tried few other tiles, they were fine. QUICK_EDIT
I did issue an update earlier but it was faulty and quickly withdrawn. Here's a new one.
Version 1.0.1
* Silhouette of existing extra images is now respected and no pixels will be drawn on background color.
* Tool will now correctly draw background color over existing tile image data (except extra images) where needed.
I am unsure on cause of the distortion issue but it seems it is related to the input image, possibly only happening on 8-bit bitmaps. I will investigate. _________________ QUICK_EDIT
If there is support for larger image than the template image like in the yesterday's version, users will
have the ability to replace with a similar image. What XCC does with full import seems restrictive. QUICK_EDIT
First post has been updated with download for the newest version which has a command line option for exporting 24-bit PNG images from the tmp files, basically reverse of what the tool usually does, plus some internal code tweaks. _________________ QUICK_EDIT
Updated first post with a new version. Fixes the extra image clipping issue brought up a long time ago, adds an option to allow overwriting background color pixels on existing extra images, improved logging and probably most importantly changed how the palette color matching works which should provide a significant performance boost and more accurate color matching, albeit not noticeable most of the time. _________________ QUICK_EDIT
the png files are in the folder redketchup. i tried doing just 1 file, but no luck. tried many other changes, but its just not doing anything
Thanks for support QUICK_EDIT
Thnx elite. So i copied 400 random tem files for it to copy in, and after i finally got all the names right, the converter says the template sizes are wrong. (It did do the ones with the right size tho.) So i have to make each file individual the right size first, sigh.
Or can it do this for me?
Is there a better way?
Edit: so i found a pretty fast way where i just opened each file and press 'insert' as many as needed and quickly save, so it has thr right size. Its still pretty fast.
2nd edit: oh i completely forgot about the tmp data lol, god im so dumb sometimes..
Alright well i tried, still gonna have to do each one individually after all lol QUICK_EDIT
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum