Bennu Game Development

English Forums => Helpdesk => Topic started by: handsource-dyko on December 17, 2010, 04:05:08 PM

Title: some tips for those who want to save indexed images and preserve the color pal.
Post by: handsource-dyko on December 17, 2010, 04:05:08 PM

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?
Title: Re: some tips for those who want to save indexed images and preserve the color pal.
Post by: Drumpi on December 17, 2010, 04:26:21 PM
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...
Title: Re: some tips for those who want to save indexed images and preserve the color pal.
Post by: handsource-dyko on December 17, 2010, 05:52:30 PM
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).

Title: Re: some tips for those who want to save indexed images and preserve the color pal.
Post by: SplinterGU on December 17, 2010, 06:00:02 PM
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.
Title: Re: some tips for those who want to save indexed images and preserve the color pal.
Post by: handsource-dyko on December 17, 2010, 06:44:26 PM
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).


Title: Re: some tips for those who want to save indexed images and preserve the color pal.
Post by: Drumpi on December 18, 2010, 01:29:13 AM
I didn't see them, but i think they can help you a little:
http://betatester.bennugd.org/snapshot/samples/

We need people working on documentation.