some tips for those who want to save indexed images and preserve the color pal.

Started by handsource-dyko, December 17, 2010, 04:05:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

handsource-dyko


I don't really know why this is, but when you save a 8 bit image created in memory, the color palette is lost.
As a work around, you can create an fpg in memory with new_fpg, put the maps created with new_map or
new_png in that fpg, and save the fpg file. The images inside that fpg will now preserve the proper color palette.

I stumbled on this issue with my new experimental malvado level background designer. This tool will become a
supplementary tool to mapedit, but solely for creating the fpg with the backgrounds and hardness maps.

Since malvado uses hardnessmaps, color palettes and their color indices are very important. After saving the fpg,
you can now save the individual maps as png's, (if you save them from the memory generated fpg) and their
palette will be correct. Now you can edit the images with your favorite image editor such as the gimp or grafx2.

I recommend grafx2 because it is designed for 8 bit images like the DIV's drawing part.

Has anyone noticed this oddity before or have any explanation why you need to use this fpg workaround?

Drumpi

I don't know, 8bits MAP format has a palette section for it, so the only thing I can think is that you don't load his palette. If you are on 8bits mode on bennu, and load a 8bits FPG, it loads it's palette by default, but don't do that with nexts FPG or any MAP.

Are you tried to use LOAD_PAL with your 8 bits map?
By the way, you don't need to load a palette to work with hardness maps, because you don't need to view them, and a pixel with color number 5 is always a color number 5, not red or yellow or brown or...
Hala, como con 1001 procesos sólo va a 9 FPS, vamos a meterle 32 veces más, a ver si revienta.
(Drumpi epic moment)

handsource-dyko

I do load the load the palette to overrule the system palette, but what I descriped happens in 16 bit or 32 bit mode
(I have some reasons for using 8 bit images in 16 bit mode,the cursors images are rgb mode).


SplinterGU

8 bits images in 16bits modes have own palette, they don't use system palette... if you want use system palette you must do pal_del on 8bpp graph.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

handsource-dyko

So, if I uderstand this correctly, loading a palette from a pal file or image overrides the system palette?

(Quite a lot of functions form mod_map are not documented on the wiki, and moddsec only shows the
data types of the function's arguments but not names of the arguments, so a lot of trial and error for me,
I have no clue what fuctions like pal_refresh, colors_set, etc etc do).



Drumpi

Hala, como con 1001 procesos sólo va a 9 FPS, vamos a meterle 32 veces más, a ver si revienta.
(Drumpi epic moment)