fpg editors being strange with image dumps

Started by MisterN, August 23, 2012, 02:28:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

I have the komplete kollection of mortal kombat sprites and i wanted to put them into fpg's. fpgedit2009 crashed after showing so many images in the explorer, and smartdpgeditor, ill have to add them one by one. i wish there were a way for me to dump some of these 300+ sprites into their own fpg files.
werg

handsource-dyko

Write an automated tool. It's simple. Be sure to change the filenames to some number scheme, because that's easier for the program.
On the wiki there should also be an old example to load and directory with png files into an fpg, but if you use numbers as filenames it can be
done a bit easier.

Example:



IMPORT "mod_map";

// etc etc there are some other modules to load as well.

GLOBAL

   int num;
   int my_fpg;
   int temp_file;
   int temp_graph;


PROCESS main ();


BEGIN


     // create a new fpg archive
     my_fpg = fpg_new ();

      num=1;

      FOR (num=1; num<999; num+=1)
             
             // get one png file an store it temporary. this assumes that the files have filenames with niumbers,
             // i.e. 001.png, 002.png, 003.png, etc
             temp_file = load_png (num+".png");
           
             // add the current png to the fpg
             fpg_add ( my_fpg , num , 0 , temp_file );

             // unload the temp png
             unload_map (temp_file);
      END   

      // save the fpg
      fpg_save (my_fpg, "mortalkombat_sprites.fpg");

END



That's probably the most crude and basic way of automating the creation of fpg's of course there are nicer ways (if you want to preserve the original filenames) but those are a bit more complex.

MisterN

thanks but after the first image, all the images look super deteriorated. I will upload the mk3 sub zero .zip. show me how i can batch them into an fpg. thanks.
werg

handsource-dyko

are they 8 bit images or rgb images? if they're 8-bit, they need to have the same palette. O, I forgot set_mode, this controls what type of fpg it will become. If it's not specified it could be 8 bit by default, I'm not 100% sure though. In doubt, try 32 bit mode.

FreeYourMind

you use fpg edit with blue icon right ? I think there is a bug on it, but is relationed only with deep color of the graphics, not the number allowed...

MisterN

#5
fpg edit 2009 and smartfpg

but im not using those to add the images. the images are rgb.

If I add them all one by one (which I will not do cause there are soooooo many images), then the images wont start deteriorating after the first.
werg

DCelso

try to use a custom bennu program to convert all images in a standarlone fpg.
You can use this code as example.
http://wiki.bennugd.org/index.php?title=Tutorial:PNG_LoadDirectory
Monstruos Diabólicos

"A PAck of classic GAMEs For BennuGD" en desarrollo
http://code.google.com/p/apagame4be/

MisterN

#7
thanks but that made no sense, i tired to figure out that program but it did nothing for me. in the console it did not sort the files right either. isnt there already some pre-made thing that will work? i saw another program, but again, after the first image, everything starts deteriorating.


//BATCH FPG

#ifndef __VERSION__
    import "mod_sdlevthandler";
    import "mod_pathfind";
#else
    import "mod_blendop";
    import "mod_text";
    import "mod_grproc";
    import "mod_video";
    import "mod_map";
    import "mod_screen";
    import "mod_path";
    import "mod_rand";
    import "mod_say";
    import "mod_mouse";
    import "mod_scroll";
    import "mod_math";
#endif

IMPORT "mod_debug";
IMPORT "mod_dir";
IMPORT "mod_file";
IMPORT "mod_key";
IMPORT "mod_draw";
IMPORT "mod_string";
IMPORT "mod_proc";
IMPORT "mod_wm";
IMPORT "mod_sys";
IMPORT "mod_joy";
IMPORT "mod_sound";
IMPORT "mod_time";
IMPORT "mod_timers";
IMPORT "mod_cd"

GLOBAL

   int num;
   int my_fpg;
   int temp_file;
   int temp_graph;


PROCESS main ();


BEGIN


     // create a new fpg archive
     my_fpg = fpg_new ();

      num=1;

      FOR (num=1; num<306; num+=1)
             
             // get one png file an store it temporary. this assumes that the files have filenames with niumbers,
             // i.e. 001.png, 002.png, 003.png, etc
             temp_file = load_png (num+".png");
           
             // add the current png to the fpg
             fpg_add ( my_fpg , num , 0 , temp_file );

             // unload the temp png
             unload_map (temp_file);
      END   

      // save the fpg
      fpg_save (my_fpg, "FPG_FILE.fpg");

END


werg

SplinterGU

sure, you need normalize the palette in all graphs, if you use 8 bpp.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

how can the code be modified so that it uses 16bit files?
werg

SplinterGU

what bpp have your source graphs? 8 or 16?
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

I dont know what the source .png's are, I uploaded them to here as a zip file a few posts earlier, should be Mortal Kombat 3 Sub Zero. if i drag and drop them one by one into a 16bit or 8bit fpg, they dont deteriorate.
werg

handsource-dyko

#12
You can use the gimp to find out if it's an 8 bit image or not, since you can convert images with it. You need to browse through the menu's but there should be a menu "image" then, "mode" and then a sub menu, rgb/indexed. One of these is greyed out, so the if rgb is greyed out, it's an 8 bit image. You can also batch convert images with Irfanview, but I don't know if it has the option of normalising a color palette. I guess the best way is to create your own tool in bennu, by using the the palette functions. I know colorpalettes can be a hassle sometimes.

darío

In SFPGE you can add several files by:

- Dragging and dropping all the files to the editor.
- Selecting multiple files in the Add Graphic dialog

You still have to press OK for each graphic.

As for your second problem:

I believe you have used the first graphic as the palette of the FPG, and you have created a 8bpp FPG. I'll explain you some options you might want to consider:

OPTION 1 - 8bpp FPG with "Adjust to FPG palette" option
If you are going to use 8bpp graphics then use the option "Adjust to FPG palette" when adding the rest of the graphics. (It's going to be a little annoying because you will have to do it for each graphic you are adding). The reason is that the PNG you are using is 8bpp and so SFPGE does not automatically adapts its colors to the FPG palette unless you use this option.

OPTION 2 - 16bpp FPG. Create a 16bpp FPG and add all the graphics. You will not have this trouble but of course your video mode should be 16bpp in your game.

OPTION 3 - (Trick) - 16bpp FPG + export + 8bpp FPG
Create a 16bpp FPG with SFPGE, add all your graphics, then export all of them (by dragg & drop to the desktop or by using the export option). The exported PNGs or MAPs are 16bpp now.
Create a 8bpp FPG with the palette you want to use and import all the graphics you exported--> Since the Graphics are 16bpp they will automatically convert to 8bpp graphics and adjust their color.

Hope it helps. Regards,
Darío
My sites:
Smart Fpg Editor - Painless FPG Edition for Bennu and PixTudio
fenixlib - .NET support for manipulating PixTudio, Bennu and Div graphic formats

SplinterGU

Quote from: DoctorN on August 24, 2012, 10:07:29 PM
thanks but that made no sense, i tired to figure out that program but it did nothing for me. in the console it did not sort the files right either. isnt there already some pre-made thing that will work? i saw another program, but again, after the first image, everything starts deteriorating.


//BATCH FPG

#ifndef __VERSION__
    import "mod_sdlevthandler";
    import "mod_pathfind";
#else
    import "mod_blendop";
    import "mod_text";
    import "mod_grproc";
    import "mod_video";
    import "mod_map";
    import "mod_screen";
    import "mod_path";
    import "mod_rand";
    import "mod_say";
    import "mod_mouse";
    import "mod_scroll";
    import "mod_math";
#endif

IMPORT "mod_debug";
IMPORT "mod_dir";
IMPORT "mod_file";
IMPORT "mod_key";
IMPORT "mod_draw";
IMPORT "mod_string";
IMPORT "mod_proc";
IMPORT "mod_wm";
IMPORT "mod_sys";
IMPORT "mod_joy";
IMPORT "mod_sound";
IMPORT "mod_time";
IMPORT "mod_timers";
IMPORT "mod_cd"

GLOBAL

   int num;
   int my_fpg;
   int temp_file;
   int temp_graph;


PROCESS main ();


BEGIN


     // create a new fpg archive
     my_fpg = fpg_new ();

      num=1;

      FOR (num=1; num<306; num+=1)
             
             // get one png file an store it temporary. this assumes that the files have filenames with niumbers,
             // i.e. 001.png, 002.png, 003.png, etc
             temp_file = load_png (num+".png");
           
             // add the current png to the fpg
             fpg_add ( my_fpg , num , 0 , temp_file );

             // unload the temp png
             unload_map (temp_file);
      END   

      // save the fpg
      fpg_save (my_fpg, "FPG_FILE.fpg");

END




you have an error here

             // unload the temp png
             unload_map (temp_file);


unload_map need 2 args, file and map.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2