[OpenRa.Utility] Converting Graphics for RA/CnC

Small chat with Chris about how to use the utility

Information and discussion for custom maps and mods.
Post Reply
wusche1
Posts: 87
Joined: Tue Jan 10, 2012 6:44 pm

[OpenRa.Utility] Converting Graphics for RA/CnC

Post by wusche1 »

Hi, since editing, extracting, creating etc graphics for Openra is a quite confusing affair, I decided to put down some information to help others in that endavour.



Step by step mini guide on how to use Openra.Utilities on the example of a cameo:

1.) Get the palette of the game, e.g. RA: OpenRa.Utility --extract ra temperat.pal

2.) Get a PNG file with the right palette settings by extracting it from a in-game ship file using the extracted palette setting: e.g. OpenRa.Utility --png ttnkicon.shp temperat.pal, with ttnkicon.shp beeing the cameo for the tesla tank.

3.) Use Photoshop (or any other program that uses the palette formats) to open the newly created ttnkicon.png and save the color table of the picture. This file has been attached as an attachment to this post.

4.) Use Photoshop (or any other program that uses the palette formats) to convert Your png format to 8bit/channel, using the custom palette saved before.

5.) Convert the PNG to SHP using OpenRa.Utility --shp YourPNGfile.png 64 , with 64 beeing the width of the cameo file.




Links of interest:

-- SHP Tools
-- shp -> png -> shp using OpenRA.Utility
-- SHP Tools
-- OPen source SHP Builder
-- OS SHP Builder 3.36 released!
-- Tileset Builder 2
-- Empty (no text) Red Alert and CnC Cameo recources









The full exempt of the chat with Chris on how to convert png to shp with the Openra utilities:


Code: Select all

&#91;21&#58;44&#93; <wuschel> Received args&#58; --shp ghostrecon.png 64
&#91;21&#58;44&#93; <wuschel> results in
&#91;21&#58;44&#93; <wuschel>  System.IO.InvalidDataException&#58; Unknown pixelformat
&#91;21&#58;44&#93; <wuschel> with the Utilities.
&#91;21&#58;44&#93; <wuschel> png is 64*48
&#91;21&#58;44&#93; <+chrisf> it needs to be 8bit, and using the correct palette already.
&#91;21&#58;44&#93; <wuschel> Ok.
&#91;21&#58;44&#93; <wuschel> I see.
&#91;21&#58;45&#93; <wuschel> RGB 8bit/channel it is.
&#91;21&#58;45&#93; <+chrisf> if you're using ps, that's `indexed color mode`, and obtain a ps-format RA palette by running --png on some shp
&#91;21&#58;50&#93; <wuschel> Actually 8bit/channel did the trick.
&#91;21&#58;50&#93; <wuschel> I need to check it now.
&#91;21&#58;53&#93; <+chrisf> you're going to be disappointed.
&#91;21&#58;53&#93; == Thor_Away has changed nick to Thorpheus
&#91;21&#58;54&#93; <+chrisf> we don't do any conversion from rgb -> indexed in the utility.
&#91;21&#58;54&#93; <+chrisf> &#40;that's actually an ugly problem, and ps does a better job than we can&#41;
&#91;21&#58;54&#93; <wuschel> Yes. I was.
&#91;21&#58;54&#93; <wuschel> &#58;/
&#91;21&#58;55&#93; <+chrisf> are you using ps?
&#91;21&#58;55&#93; <wuschel> Yes.
&#91;21&#58;55&#93; <+chrisf> ok, there's 2 things you need to do&#58;
&#91;21&#58;55&#93; <wuschel> Now I have a "LSD Infantry" unit.
&#91;21&#58;55&#93; <+chrisf> - obtain the ra palette.
&#91;21&#58;56&#93; <+chrisf> use --png on some existing SHP; open the png in ps; save the color table
&#91;21&#58;56&#93; <+chrisf> the second part is to use that color table&#58;
&#91;21&#58;56&#93; <+chrisf> - open your png; image->mode->indexed; load the color table you saved before
&#91;21&#58;57&#93; <wuschel> I see. However, the png command requires a palette as well.
&#91;21&#58;57&#93; <wuschel> --> --png SHPFILE PALETTE &#91;--transparent&#93; Convert a SHP to a PNG containing all of its frames, optionally setting up transparency
&#91;21&#58;57&#93; <wuschel> and --png someshpfile does not owrk.
&#91;21&#58;57&#93; <wuschel> work.
&#91;21&#58;57&#93; <+chrisf> wuschel&#58; do --extract ra temperat.pal
&#91;21&#58;58&#93; <wuschel> ok
&#91;21&#58;58&#93; <+chrisf> then --png someshpfile temperat.pal
&#91;21&#58;59&#93; <+chrisf> that produces an indexed color png, with the correct palette embedded
&#91;21&#58;59&#93; <+chrisf> the silly indirect method of obtaining the palette is needed because ps can't read westwood .pal
&#91;22&#58;00&#93; <wuschel> I see.
&#91;22&#58;00&#93; <wuschel> Will put that on the wiki
&#91;22&#58;02&#93; <+chrisf> &#40;and i dont want to write a .pal -> .act conversion just for ps's benefit&#41;
&#91;22&#58;03&#93; <+chrisf> the other thing i'll mention is that most unit authors use a custom palette with a magenta remap range
&#91;22&#58;03&#93; <+chrisf> you can find a copy of that on the forum
&#91;22&#58;03&#93; <+chrisf> &#40;it helps the rgb -> indexed conversion to not confuse remap with other yellowish bits&#41;
Attachments
color_table_RA.zip
Extracted color table to load with Photoshop. Note that there might be another color table on the forums with the beforementioned correction. This was used for successful conversions in the 2011-1223 playtest.
(789 Bytes) Downloaded 402 times
TTNKicon with the RA palette, as requested by Petrenko. Note that I did not find the beforementioned magenta/yellow color palette on the forums yet (read chat log in post above).
TTNKicon with the RA palette, as requested by Petrenko. Note that I did not find the beforementioned magenta/yellow color palette on the forums yet (read chat log in post above).
ttnkicon.png (2.83 KiB) Viewed 6324 times
Last edited by wusche1 on Sat Feb 11, 2012 11:24 am, edited 5 times in total.

User avatar
BaronOfStuff
Posts: 438
Joined: Sun May 22, 2011 7:25 pm

Post by BaronOfStuff »

I must be missing something, this only explains how to extract SHP files as PNG's? :P

User avatar
Petrenko
Posts: 156
Joined: Fri Apr 08, 2011 5:36 pm

Post by Petrenko »

Can i get a indexed .png please?
Hail to the soviets!

wusche1
Posts: 87
Joined: Tue Jan 10, 2012 6:44 pm

Post by wusche1 »

BaronOfStuff wrote: I must be missing something, this only explains how to extract SHP files as PNG's? :P
It does. But I was too lazy to extract the info. Updated the first post =)
Petrenko wrote: Can i get a indexed .png please?
Not right now, I am not at my usual computer. I am sure there will be another volunteer.

User avatar
BaronOfStuff
Posts: 438
Joined: Sun May 22, 2011 7:25 pm

Post by BaronOfStuff »

Ah, cheers. This is great stuff, and has just made converting everything about 500x faster for me.

wusche1
Posts: 87
Joined: Tue Jan 10, 2012 6:44 pm

Post by wusche1 »

BaronOfStuff wrote: Ah, cheers. This is great stuff, and has just made converting everything about 500x faster for me.
My pleasure. I added some more links to the post.

@Petrenko: I posted the PNG as requested.

Post Reply