aliens

Author Topic: [Solved] OXCE vs OpenXcom images  (Read 2161 times)

Offline pjlasl

  • Captain
  • ***
  • Posts: 54
    • View Profile
[Solved] OXCE vs OpenXcom images
« on: December 24, 2021, 07:00:48 am »
I am learning how to create a new unit and I have come across something interesting. I have a corpse image I am adding to BIGOB and it is a .png.
Under OpenXcom everything works great, but under OXCE it says I can only use 8bit images.
I converted that image to a .bmp 256 color and now the game loads, unfortunately under OXCE this images looks horrible and it lost its transparency in game.
Can anyone provide some guidance?

* edit: I did find a modding tools website that corrected the image palette, but the background transparency is still there in OXCE.
« Last Edit: February 12, 2023, 12:14:02 pm by Meridian »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: OXCE vs OpenXcom images
« Reply #1 on: December 24, 2021, 07:59:19 am »
(Edit: I see you already had located Falko's Modding Tools. I'll place my previous message about it inside a 'spoiler' window to get it out of the way.)
Spoiler:
You may find this tool helpful.

Falko created a collection of programs for modding OpenXcom:
https://openxcom.org/forum/index.php/topic,2980.0.html

One of them corrects images to be in the correct format for running with either X-COM: UFO Defense or X-COM: Terror From The Deep.

OXC-ModTools Palette converter:
https://falkooxc2.pythonanywhere.com/spritepalette

You don't need to download anything it works right off the website.


Try running your image through that program and see if it helps.

If it doesn't work or removes the background transparency try both the 'fix-palette(ufo-battlescape)' setting and the 'set-palette(ufo-battlescape)' setting.


To use the program:

(1) Click the "Drop files here or Click to upload multiple images" button.

(2) Select your images.

(3) If needed choose your palette.

(4) Press "Convert".

(5) Press "Download" to gain access to the converted file.


With large sprite sheets it can take a moment or two to finish after pressing convert, you'll know it is done when the "Download" button isn't faded anymore.


EDIT:

* edit: I did find a modding tools website that corrected the image palette, but the background transparency is still there in OXCE.

I've also found that the transparency is lost at times when using Falko's tool, I'm not sure exactly what causes it.

Using Falko's tool try clicking 'fix-palette(ufo-battlescape)' setting and changing it to the 'set-palette(ufo-battlescape)' setting instead, sometimes the 'set' option assigns the background as a transparency when the 'fix' option does not.

Another solution I use when this occurs is to add the transparency back into the image using a program like GIMP then send the corrected image back through Falko's tool again.

If the background turns green it has usually worked and the transparency will be intact. (Or pink if the image is being converted to work with Terror From The deep.)

Although I'm using it GIMP is not recommended for creating images for use with OpenXcom because it can alter the indexed palette unexpectedly. Try one of these instead if you aren't already: image editors / graphics


If you attach the image that is giving you trouble to your forum post I'll take a look at it and try to add the transparency if you wish.
« Last Edit: December 24, 2021, 08:27:14 am by The Martian »

Offline pjlasl

  • Captain
  • ***
  • Posts: 54
    • View Profile
Re: OXCE vs OpenXcom images
« Reply #2 on: December 24, 2021, 05:59:04 pm »
Many Thanks! I guess I used the wrong settings. Here are the steps I took:

1. I used this site to set the background to transparent: https://onlinepngtools.com/create-transparent-png
2. I uploaded the image to Falko's and used Fix-Palette (ufo-battlescape). The background turned green like you mentioned.
3. I loaded into the game and it worked!

But I do have my other question: Why did the original .png work in OpenXCom as is, but I had to go thru these hoops to make it work with OXCE?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9103
    • View Profile
Re: OXCE vs OpenXcom images
« Reply #3 on: December 24, 2021, 07:10:30 pm »
But I do have my other question: Why did the original .png work in OpenXCom as is, but I had to go thru these hoops to make it work with OXCE?

OpenXcom still allows the SDL framework to convert 32-bit images into 8-bit images automatically.
This process is untested, unsupported, unreliable and not recommended even in OpenXcom.

That's why OXCE explicitly disabled it... it's bad for the devs, modders and players alike.

Offline pjlasl

  • Captain
  • ***
  • Posts: 54
    • View Profile
Re: OXCE vs OpenXcom images
« Reply #4 on: December 25, 2021, 06:42:20 am »
Thanks for the explanation.