[Editor Plugin API] Any way to extract 8-bit Sprites/Backgrounds?

Started by Denzil Quixode, Wed 01/09/2010 10:42:57

Previous topic - Next topic

Denzil Quixode

It is quite easy to get a Bitmap from any sprite or room background, but it seems like these are always full-colour RGB Bitmaps, including when they were originally 8-bit paletted, which loses the palette information. Is there any way to get these out as an 8-bit Bitmap, so it includes the palette? This would be very useful for an exporter plugin I'm working on. (I know 8-bit games are unusual nowadays but I'd still like to support them ;D)

Gilbert

Alternately, as DynamicSprite.SaveToFile() (as well as SaveScreenShot() ) saves stuff to image files in the game's own colour depth (note: if the game is not 8-bit already, there is no point in exporting resource in 8-bit colour resolution anyway), you may just write a few lines of codes that create DynamicSprite copies of the sprites and the background frames and save them as files. All you need is to run the game.

Denzil Quixode

I'm not sure it would be so easy to have a game load every room and run a special script in each one without a lot of tedious manual editing of room scripts, particularly on a large game, and then you'd have to go back and remove it all again... or, maybe it could be done with a very clever bit of on_event() hacking? Even so, I think it still wouldn't be ideal, to require people to change their game in some way to use the exporter... you'd expect it to be fully automatic.

Thanks for the suggestion though! I don't mean to be ungrateful :)

Pumaman

The AGS Editor internally stores the sprite images in a raw memory format. When one is rendered to the screen, it converts it to a 32-bit Bitmap.

This is because the .NET framework has various limitations with 8-bit bitmaps, and even internally the editor doesn't have any functionality to deal with 8-bit .NET Bitmap objects. Potentially the plugin API could expose this raw format, but it wouldn't be easily handled by .NET code.

Denzil Quixode

Quote from: Pumaman on Thu 02/09/2010 22:06:04
This is because the .NET framework has various limitations with 8-bit bitmaps, and even internally the editor doesn't have any functionality to deal with 8-bit .NET Bitmap objects. Potentially the plugin API could expose this raw format, but it wouldn't be easily handled by .NET code.
Even so I would really appreciate it, even if I had to deal with raw byte[] arrays or something.

Pumaman

Actually, I've just checked the editor code, and the Plugin API IAGSEditor.GetSpriteImage() method should give you a Bitmap with the correct colour depth, even for 8-bit sprites. Was this the method you were trying to use?

Denzil Quixode

Ah, to be honest I think I only tried to do it with room backgrounds and assumed sprites would have the same problem without checking :-X Sorry... so if sprites already do preserve the palette, could room backgrounds do the same?

Pumaman


SMF spam blocked by CleanTalk