By: Zeus81
Introduction
Simply a script to save bitmaps in both bmp and png formats.
I know it already exists but I don't share this without reason, my version is "optimized".
Script
https://www.dropbox.com/s/3lqtjvosnrnnet3/Bitmap Export.rb
Instructions
- exporting in bmp format :
bitmap.export('prout.bmp')
or
bitmap.save('prout.bmp')
Exporting in bmp is extremly fast, but not compressed.
Since it's bmp32 it also keeps alpha channel, however not many softwares can deal with it, I just know that RPG Makers and Gimp 2.6 can.
- exporting in png format :
bitmap.export('prout.png')
or
bitmap.save('prout.png')
png is compatible with almost anything and quite well compressed, but it takes a little more time, not that much either unless you're exporting a huge bitmap.
If you don't specify any extension when exporting .png will be added automatically.
- serialize bitmap :
open('prout.rxdata', 'wb') {|file| Marshal.dump(bitmap, file)}
bitmap = open('prout.rxdata', 'rb') {|file| Marshal.load(file)}
or
save_data(bitmap, 'prout.rxdata')
bitmap = load_data('prout.rxdata')
It's quite fast and as compressed as png but only compatible with this script, you can use it if you want to store picture directly into savestates.
- snapshot
Graphics.export('prout.png')
or
Graphics.save('prout.png')
or
Graphics.snapshot('prout.png')
This is a quick way to do a screenshot.
filename is optional, and will be replaced by datetime if omitted.