Author Topic: Applying palettes in gimp  (Read 19523 times)

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11731
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Applying palettes in gimp
« Reply #15 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, 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 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!
« Last Edit: June 25, 2015, 06:01:36 pm by Solarius Scorch »

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
Re: Applying palettes in gimp
« Reply #16 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 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

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
  • 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, 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 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

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Applying palettes in gimp
« Reply #17 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.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Applying palettes in gimp
« Reply #18 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?


Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Applying palettes in gimp
« Reply #19 on: July 19, 2015, 02:51:40 pm »
What color "id" have background? It should be 0

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Applying palettes in gimp
« Reply #20 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

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: Applying palettes in gimp
« Reply #21 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 .

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Applying palettes in gimp
« Reply #22 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. :)