Problems with png

Nov 2, 2017, 11:58 am
#1
Joined: Apr 2, 2014
Occupation: Navastating
Location: Aslona
Posts: 773
I tried to port over some graphics from CLIVAN, so that we can have eg. mangos for the Dark Forest, but I seem to have screwed up. The game now crashes with the following error message:

ivan/Graphics/Item.png is not in indexed color mode!

Would anyone know where I screwed up and what is possible to do to fix this issue?
Nov 2, 2017, 12:50 pm
#2
Joined: Sep 5, 2010
Posts: 103
your image editor prolly converted png to true-color behind your back (your png is 24-bit one). it is not possible to "fix" it, only do it all again, closely watching for conversions. remember, you cannot have non-256-color pngs for I.V.A.N., and png palette should be left intact too!

p.s.: that is, convert 24-bit png back to paletted one won't work as expected.
Nov 2, 2017, 1:01 pm
#3
Joined: Sep 5, 2010
Posts: 103
here's my console utility to copy graphics. it can load paletted png or pcx file, and writes .new.png files. use it like this:

zgfxcopy.exe Item.png destx desty Item.pcx srcx srcy

here, "Item.png" is destination file, "Item.pcx" is source file, "dest" and "src" are destination and source coordinates in pixels, respectively. it will create "Item.new.png" file with 16x16 tile copied, and will try to do color translation for you.

dunno if it will work right with comm. pngs, tho: for some unknown reason comm. fork has palette written backwards, and color translation code may be confused by that.
Attached files
zgfxcopy.7z (332.21 kb)
Nov 2, 2017, 1:14 pm
#4
Joined: Dec 2, 2007
Location: New Attnam
Interests: bananas
Posts: 2,309
Most images, PNG included, have different modes available.

RGB - any color is allowed
Indexed - only a certain limited subset of colors is allowed (defined as the palette)
Grayscale - only shades of gray allowed

You must have saved it in RGB mode
But be careful because even if you switch back to Indexed, the palette may have changed
Nov 2, 2017, 2:11 pm
#5
Joined: Apr 2, 2014
Occupation: Navastating
Location: Aslona
Posts: 773
Thank you both, I'll see what I can manage, then.
Nov 2, 2017, 2:28 pm
#6
Joined: Dec 11, 2008
Posts: 1,770
I believe this is why the recommended approach for graphics editing way back when fejoa was working on CLIVAN was to use IrfanView and GraphicsGale, because GraphicsGale automatically detects and uses the colour index of the image, and IrfanView made it easier to save to PCX (?).
Maybe now that IVAN uses PNGs we could just use GraphicsGale by itself?
System would indicate in graphic if person is mounted on horse or not.
Same system also show if person mounted on boar, elephant, polar bear etc.
Or if person mounted on ass.
Ivan find mounting on ass funny.
Nov 2, 2017, 4:28 pm
#7
Joined: Sep 8, 2010
Occupation: Petty Functionary
Location: Drinking pea soup in the world map
Interests: Mangoes
Posts: 1,216
4zb4 wrote
Maybe now that IVAN uses PNGs we could just use GraphicsGale by itself?

Yeah IrfanView and GraphicsGale respect the pallette. You can definitely use GG on just the PNGs now and save them, it even loads the pallette into the pallette window by default. If you're Linux you can run on wine: https://appdb.winehq.org/objectManager.php?sClass=applic...
Batman? wrote
its been so long since i had gotten that far i didnt think it through. arrrr!!!!!!
Nov 3, 2017, 3:48 am
#8
Joined: Sep 5, 2010
Posts: 103
also, mtPaint is nice to work with pngs too.
Nov 3, 2017, 8:52 am
#9
Joined: Dec 11, 2008
Posts: 1,770
I tested it out with Photoshop today, and while you can get it to work and not ruin the image when saving/editing, it's a pain in the ass to do so. You need to export the color table from the image, then load that as a swatch to ensure you don't use colors outside of the index range. Next you change the image mode from "indexed" to "RGB" for editing, and do your stuff. Then you need to convert the mode back to "indexed" and load the color table you exported earlier again to force it to only use the allowed colors. And THEN you save it as PNG.
Photoshop is a bit overkill for editing like this though.
System would indicate in graphic if person is mounted on horse or not.
Same system also show if person mounted on boar, elephant, polar bear etc.
Or if person mounted on ass.
Ivan find mounting on ass funny.
Jump to