OpenXcom Forum

Modding => Tools => Topic started by: hellrazor on June 20, 2015, 02:41:44 pm

Title: Applying palettes in gimp
Post by: hellrazor on June 20, 2015, 02:41:44 pm
Hi guys,

i am just trying to do some FloorOb and some HandOb's for Rysekliinis grenade Launcher Mod.

I was able to crop together a FloorOb for the Frag Ammo by rescaling and turning the Bigob.
Now i did this with gimp...

And obviously the colorpalette is totally screwed up :-/

See files attached. How can i fix this?
Title: Re: Applying palettes in gimp
Post by: yrizoud on June 20, 2015, 04:48:00 pm
These ones were easy to fix using Grafx2, but it's not always the case.

Really, it's safer and easier to do your complete graphic work (I mean, from start to finish) in any program of the "good list"
https://openxcom.org/forum/index.php/topic,2676.0.html
Title: Re: Applying palettes in gimp
Post by: hellrazor on June 20, 2015, 08:54:41 pm
These ones were easy to fix using Grafx2, but it's not always the case.

Really, it's safer and easier to do your complete graphic work (I mean, from start to finish) in any program of the "good list"
https://openxcom.org/forum/index.php/topic,2676.0.html

Well thanks for the effort, but i actually wanted to know how to do this myself.
Since there are a couple of sprites i need to do, so this knowing how doing it would help.

I have gimp installed here and i know how to work with it, at least more then with graphx (which i already tried and it screwing up the palette in the same way, and the image
editing is very limited).

Is there a way to fix the palette after i did all the sprites?
A how to or description on actually doing it myself would be really helpful.
Title: Re: Applying palettes in gimp
Post by: hellrazor on June 20, 2015, 09:38:56 pm
Ok is there noone who can explain this to me in detail?

I do not understand why all of those image editing programs are so complicated....
Title: Re: Applying palettes in gimp
Post by: Hobbes on June 20, 2015, 10:40:05 pm
Ok is there noone who can explain this to me in detail?

I do not understand why all of those image editing programs are so complicated....

It's quite simple: GIMP screws up XCom palettes, no matter what you do. Either use another editor or get used to it. :)
Title: Re: Applying palettes in gimp
Post by: hellrazor on June 20, 2015, 11:44:00 pm
It's quite simple: GIMP screws up XCom palettes, no matter what you do. Either use another editor or get used to it. :)

Well i also tried Graphx, but with this programm i can't turn the sprite or cut it or rescale it, and it screwed up the palette also.

Then i tried falcos spritetool (https://falkooxc2.pythonanywhere.com/spritepalette#)
Which can reapply the palette, but only produces *.png... and the Ammosprites draw over the ammobox...

So what can i do know?
Title: Re: Applying palettes in gimp
Post by: hellrazor on June 21, 2015, 12:06:20 am
These ones were easy to fix using Grafx2, but it's not always the case.

Really, it's safer and easier to do your complete graphic work (I mean, from start to finish) in any program of the "good list"
https://openxcom.org/forum/index.php/topic,2676.0.html

Can you describe me in details what you did step by step?
Title: Re: Applying palettes in gimp
Post by: yrizoud on June 21, 2015, 12:47:28 am
To fix such image in Grafx2 :
(Grafx2 keeps two documents open at the same time. The one you see is called the "main page", and the hidden is called the "spare page")
Before starting :

Putting the colors in the right indices
Checking the background color

GIF transparency

This is totally optional because openxcom doesn't care about it, but for web usage, you can check that the right transparent color is selected.
Title: Re: Applying palettes in gimp
Post by: Hobbes on June 21, 2015, 07:20:35 am
To fix such image in Grafx2 :
(Grafx2 keeps two documents open at the same time. The one you see is called the "main page", and the hidden is called the "spare page")
Before starting :

Putting the colors in the right indices
  • Open the image that you want to fix
  • Use the magnifier (https://grafx2.googlecode.com/svn/wiki/pictures/menu_buttons/Magnify.png) then mouse wheel to see a larger part of the image, you'll need it.
  • Switch pages (TAB key, or left-click the page icon (https://grafx2.googlecode.com/svn/wiki/pictures/menu_buttons/Pages.png))
  • Open an image which has the correct palette for what you're doing. Just pick an image from an openxcom mod that everybody has
  • Right click the page icon, and select "Copy to spare : Palette and remap"
  • Switch pages again
Checking the background color
  • Right-click the fill icon (https://grafx2.googlecode.com/svn/wiki/pictures/menu_buttons/Fill.png)
  • Hover the mouse on a part of the image which "should" be transparent. In the status bar, if you see that it's color 0, you can stop there. The status line should list something like X: 384 Y:243 (■  0)
  • Left click. It replaces every occurrence of this color with color zero

GIF transparency

This is totally optional because openxcom doesn't care about it, but for web usage, you can check that the right transparent color is selected.
  • Click the "layers" icon (https://grafx2.googlecode.com/svn/wiki/pictures/menu_buttons/Layer.png)
  • Check that the number is zero. If it's not, click on the number button, then click on the image in any part that should be transparent
  • Check "Background" if you want the GIF(or PNG) to use transparency. If you want the image to be fully opaque, uncheck it

Kudos for this explanation :)
Title: Re: Applying palettes in gimp
Post by: hellrazor on June 21, 2015, 08:25:32 am
I will give this a try now.
I was so frustrated about this yesterday, that i now have to redo all the graphic work i did yesterday already :-/

EDIT: Success! Thanks yrizoud!!!
Title: Re: Applying palettes in gimp
Post by: Solarius Scorch on June 21, 2015, 12:36:41 pm
Good for you. :) I'm interested in this. :q

(Although I think a simpler idea would be to use Photoshop. ;) )
Title: Re: Applying palettes in gimp
Post by: hellrazor on June 21, 2015, 12:42:42 pm
Good for you. :) I'm interested in this. :q

(Although I think a simpler idea would be to use Photoshop. ;) )

Well jeah probably, i actually also made some HandOb's for the Grenade Launcher Ammo.
See attached Screenshots:
Title: Re: Applying palettes in gimp
Post by: yrizoud on June 21, 2015, 03:47:44 pm
After an image is in the wrong palette, you can't fix it back within Photoshop, can you?
Title: Re: Applying palettes in gimp
Post by: Solarius Scorch on June 21, 2015, 04:39:10 pm
After an image is in the wrong palette, you can't fix it back within Photoshop, can you?

You can. You just need to open it, change the mode to RGB, and then change the picture to the Openxcom palette. Of course you need to prepare the palette first by opening a good file and saving its palette to .pal.
Title: Re: Applying palettes in gimp
Post by: yrizoud on June 21, 2015, 07:30:41 pm
It's the "change the picture to the Openxcom palette" step that I don't know how you do.
The only way I could image is by using the menu "Image / Mode / Color Table", and "Load", but I just tried, and it replaces the palette entries without remapping the pixels.
Title: Re: Applying palettes in gimp
Post by: Solarius Scorch on June 22, 2015, 12:58:20 am
It's the "change the picture to the Openxcom palette" step that I don't know how you do.
The only way I could image is by using the menu "Image / Mode / Color Table", and "Load", but I just tried, and it replaces the palette entries without remapping the pixels.

Hmmm. Let's go through it step by step to make sure it's fine.

First of all, we need to determine which palette we need, because OpenXCom uses a couple:
- general (used for bigobs and Ufopaedia)
- battlescape
- interception
- base
- ufopaedia only
(not a guaranteed complete list, but probably)
For the sake of an example, I'll assume we're doing a weapon - which means a "general" palette.

First, let's make the palette file. I'll use Dioxine's Flamethrower mod (https://www.openxcom.com/mod/flamethrower), and specifically Flamethrower.gif.

1) Making the palette file.
a) Open the Flamethrower.gif file in Photoshop. (CS3 in my case, not sure if other versions are any different)
b) Image -> Mode -> Color Table.
c) Save... -> Save as palette-general.act.

Now,
2) Converting the new image.
I'll take OpenXCom's logo (https://openxcom.org/wp-content/uploads/2013/05/logo.png) as an example.
a) Open the logo.png file in Photoshop.
b) Image -> Mode -> Indexed Color...
c) In the Palette... drop-down menu, choose Custom...
d) Load your palette-general.act and click OK, then OK.
e) Done!
Title: Re: Applying palettes in gimp
Post by: Aldorn on July 06, 2015, 07:31:42 pm
To fix such image in Grafx2 :
(Grafx2 keeps two documents open at the same time. The one you see is called the "main page", and the hidden is called the "spare page")
Before starting :

Putting the colors in the right indices
  • Open the image that you want to fix
  • Use the magnifier (https://grafx2.googlecode.com/svn/wiki/pictures/menu_buttons/Magnify.png) then mouse wheel to see a larger part of the image, you'll need it.
  • Switch pages (TAB key, or left-click the page icon (https://grafx2.googlecode.com/svn/wiki/pictures/menu_buttons/Pages.png))
  • Open an image which has the correct palette for what you're doing. Just pick an image from an openxcom mod that everybody has
  • Right click the page icon, and select "Copy to spare : Palette and remap"
  • Switch pages again
Checking the background color
  • Right-click the fill icon (https://grafx2.googlecode.com/svn/wiki/pictures/menu_buttons/Fill.png)
  • Hover the mouse on a part of the image which "should" be transparent. In the status bar, if you see that it's color 0, you can stop there. The status line should list something like X: 384 Y:243 (■  0)
  • Left click. It replaces every occurrence of this color with color zero

GIF transparency

This is totally optional because openxcom doesn't care about it, but for web usage, you can check that the right transparent color is selected.
  • Click the "layers" icon (https://grafx2.googlecode.com/svn/wiki/pictures/menu_buttons/Layer.png)
  • Check that the number is zero. If it's not, click on the number button, then click on the image in any part that should be transparent
  • Check "Background" if you want the GIF(or PNG) to use transparency. If you want the image to be fully opaque, uncheck it

Hmmm. Let's go through it step by step to make sure it's fine.

First of all, we need to determine which palette we need, because OpenXCom uses a couple:
- general (used for bigobs and Ufopaedia)
- battlescape
- interception
- base
- ufopaedia only
(not a guaranteed complete list, but probably)
For the sake of an example, I'll assume we're doing a weapon - which means a "general" palette.

First, let's make the palette file. I'll use Dioxine's Flamethrower mod (https://www.openxcom.com/mod/flamethrower), and specifically Flamethrower.gif.

1) Making the palette file.
a) Open the Flamethrower.gif file in Photoshop. (CS3 in my case, not sure if other versions are any different)
b) Image -> Mode -> Color Table.
c) Save... -> Save as palette-general.act.

Now,
2) Converting the new image.
I'll take OpenXCom's logo (https://openxcom.org/wp-content/uploads/2013/05/logo.png) as an example.
a) Open the logo.png file in Photoshop.
b) Image -> Mode -> Indexed Color...
c) In the Palette... drop-down menu, choose Custom...
d) Load your palette-general.act and click OK, then OK.
e) Done!

Men, thanks for these guides
Title: Re: Applying palettes in gimp
Post by: Warboy1982 on July 11, 2015, 10:10:30 am
It's the "change the picture to the Openxcom palette" step that I don't know how you do.
The only way I could image is by using the menu "Image / Mode / Color Table", and "Load", but I just tried, and it replaces the palette entries without remapping the pixels.

the key step is to convert the image to RGB first, then switch it back to indexed color, at which point you can load in the xcom palette.
Title: Re: Applying palettes in gimp
Post by: Hobbes on July 19, 2015, 02:00:28 pm
I've redone a few graphics using the grafx2-2.5 program and I thought it was working until I got the attached result where the transparency of a unit is overriding everything else. Any tips on how to solve this?

Title: Re: Applying palettes in gimp
Post by: Yankes on July 19, 2015, 02:51:40 pm
What color "id" have background? It should be 0
Title: Re: Applying palettes in gimp
Post by: Hobbes on July 19, 2015, 03:37:59 pm
What color "id" have background? It should be 0

This is what I did:
Quote
Putting the colors in the right indices
Open the image that you want to fix
Use the magnifier  then mouse wheel to see a larger part of the image, you'll need it.
Switch pages (TAB key, or left-click the page icon )
Open an image which has the correct palette for what you're doing. Just pick an image from an openxcom mod that everybody has
Right click the page icon, and select "Copy to spare : Palette and remap"
Switch pages again
Checking the background color
Right-click the fill icon
Hover the mouse on a part of the image which "should" be transparent. In the status bar, if you see that it's color 0, you can stop there. The status line should list something like X: 384 Y:243 (■  0)
Left click. It replaces every occurrence of this color with color zero

I think the transparency colors are all 0 but I'm getting the same result. Here's one of the messed up files attached
Title: Re: Applying palettes in gimp
Post by: yrizoud on July 19, 2015, 04:33:55 pm
The background of your sprites is color 63 (darkest green), with some stray white pixels in some sprites because you used flood-fill, and also some black and white bars on the left side.
You can use the colorpicker (pipette) tool to determine the color of what you're pointing.

Here is a cleaned up version. I don't know what to do with the last 8 sprites which have weird white-grey parts, I guess they are leftovers and unused .
Title: Re: Applying palettes in gimp
Post by: Hobbes on July 19, 2015, 05:16:44 pm
The background of your sprites is color 63 (darkest green), with some stray white pixels in some sprites because you used flood-fill, and also some black and white bars on the left side.
You can use the colorpicker (pipette) tool to determine the color of what you're pointing.

Here is a cleaned up version. I don't know what to do with the last 8 sprites which have weird white-grey parts, I guess they are leftovers and unused .

Thanks, I've already fixed all of the sprites with issues. :)