[XP] Bitmap2Code

Started by Blizzard, January 10, 2008, 09:06:20 am

Previous topic - Next topic

Blizzard

January 10, 2008, 09:06:20 am Last Edit: March 23, 2019, 06:37:56 am by Blizzard
Bitmap2Code
Authors: Blizzard
Version: 1.2
Type: Script Development Tool
Key Term: Scripting Tool



Introduction

Ever made a script, but you need to include several little image files for it to work? This is not necessary anymore! With the Bitmap2Code converter you can simply convert bitmap images into RGSS code. Instead of loading the file into the memory from a file, the bitmap will be generated via code.
This little script allows you to quickly load bitmaps converted to code with the Bitmap2Code.exe converter.

This work is licensed under BSD License 2.0:
Quote
Copyright (c) Boris "Blizzard" Mikić
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1.  Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.

2.  Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

3.  Neither the name of the copyright holder nor the names of its contributors
    may be used to endorse or promote products derived from this software
    without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.


You may use this script for both non-commercial and commercial products without limitations as long as you fulfill the conditions presented by the above license. The "complete" way to give credit is to include the license somewhere in your product (e.g. in the credits screen), but a "simple" way is also acceptable. The "simple" way to give credit is as follows:
Quote
Bitmap2Code licensed under BSD License 2.0, Copyright (c) Boris "Blizzard" Mikić


Alternatively, if your font doesn't support diacritic characters, you may use this variant:
Quote
Bitmap2Code licensed under BSD License 2.0, Copyright (c) Boris "Blizzard" Mikic


In general other similar variants are allowed as long as it is clear who the creator is (e.g. "Bitmap2Code created by Blizzard" is acceptable). But if possible, prefer to use one of the two variants listed above.

If you fail to give credit and/or claim that this work was created by you, this may result in legal action and/or payment of damages even though this work is free of charge to use normally.



Features


  • instead of loading image files, the bitmaps will be generated via code
  • optimizer recognizes same colors and optimizes generated code if possible
  • several quality options to simplify code by decreasing the number of colors
  • easy to use: set up the config file, copy the files, run the converter and just copy paste the generated code into your RGSS Editor
  • easy to implement into any script: just call RPG::Cache.load_code("NAME") instead of the usual bitmap loading methods



Screenshots

N/A for this type of script


Demo

N/A for this type of script. You can download the Bitmap2Code package and try it out, there are 3 example files within.


Script

Just make a new script above main and paste this code into it.
Script Download

Download this package with the .exe and 3 example images to see how it works. Note that this here is ACTUALLY THE CONVERTER! You need this converter in order to create codes for images. There is also a file with the script code from the link above.
Bitmap2Code package

Files included:
Bitmap2Code script.txt
Bitmap2Code.exe
Bitmap2Code.ini
Bitmap2Code.rgssad
Bitmap2Code_PKE.exe
Bitmap2Code_PKE.ini
Bitmap2Code_PKE.rgssad
black_box.png
Config.ini
map_indicator.png
movie_stripes.png
readme.txt
result.txt


Instructions

Download the Bitmap2Code package and read the readme.txt.


Compatibility

Does not load normal resource image files. Easy to implement into any script. 90% chance of full compatibility with any SDK.


Credits and Thanks


  • Boris "Blizzard" Mikić



Author's Notes

If you find any bugs, please report them here:
http://forum.chaos-project.com

That's it! Enjoy! =D
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

This is the biggest grave dig ever and I've read the instructions repeatedly and I just dont understand them or understand how to use this, I do however understand what it does I just dont know how to use it >_>

Hey look! Its a bird, No its a plane!

Wait nvm its just that big failure G_G

Ryex

basically G_G, the bitmap2code.exe takes a picture and then creates a .txt file that has the needed code to generate the image through script.
you simply open the bitmap2code.ini file and use the tags in the readme to tell it which images to convert and how to do the conversion
then you would use RPG::Cache.load_code(file) to retrieve the bitmap that is the image you converted where 'file' is the name of the txt file.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

okay that makes more sense, thanks ryex, sorry blizz for gravedigging so far  :twitch:

Blizzard

No problem. One of the purposes of this threads is to get questions answered after all.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.