- Joined
- Jul 6, 2012
- Messages
- 8
- Reaction score
- 7
- First Language
- English
- Primarily Uses
Introduction
This is a DLL with accompanying Ruby script for modifying bitmap colors. It adds a few methods for recoloring bitmaps or changing bitmap color levels.
Features
- Recolor a bitmap maintaining the original brightness.
- Recolor a bitmap with a mask to determine brightness and blending.
- Modify the color levels of a bitmap.
Instructions
Alright, so let's say we simply want to turn it into an orange color.
We'll end up with something like this.
Alright so how about this time we use a mask image and a red color instead. I'll show a variety of different brightness and alpha values for quick demonstration. The transparency layer was made visible for better viewing.
If your mask image is smaller than the target bitmap, you can tell it to repeat the pattern (false by default). Here's what we end up with.
A value of 128 on the mask is essentially the original brightness. A higher value will make the pixels brighter than the original towards max brightness. A lower value will make the pixels darker than the original towards minimum brightness (black in this case). A value of 0 skips processing of that pixel. The alpha layer does just what you would expect by alpha blending with the original color.
Next up we have the "set levels" function. With this we can modify specific channels and ranges of values as well as the brightness.
Alright let's put a heavy emphasis on green values, tone down the red, nearly drop the blue, and highlight mid values while making higher values darker.
How about something really bizzare this time.
Further instructions can be found in the script comments at the top.
Additional Notes
This should theoretically work for VX and earlier but I do not have a way of testing it. If it doesn't work for VX, please let me know.
Download
DLL Download
http://www.4shared.c...rnbmcolors.html
Script
http://pastebin.com/AHheHtHC
Terms of Use
See script for terms of use.
This is a DLL with accompanying Ruby script for modifying bitmap colors. It adds a few methods for recoloring bitmaps or changing bitmap color levels.
Features
- Recolor a bitmap maintaining the original brightness.
- Recolor a bitmap with a mask to determine brightness and blending.
- Modify the color levels of a bitmap.
Instructions
Let us say our original bitmap is the RPGMaker cloak, blown up for better viewing.

Code:
bitmap.colorify!( Color.new(200, 100, 0, 255) )


Code:
bitmap.colorify_masked!( Color.new(200, 50, 50, 255), bitmapmask, false )

Next up we have the "set levels" function. With this we can modify specific channels and ranges of values as well as the brightness.
Alright let's put a heavy emphasis on green values, tone down the red, nearly drop the blue, and highlight mid values while making higher values darker.
color_levels = Color_Levels.new
color_levels.set_point
blue, 190, 80).set_point
blue, 255, 80)
greens = {100 => 80, 150 => 135, 185 => 255}
reds = {205 => 105, 253 => 140, 255 => 160}
values = {135 => 170, 255 => 140}
color_levels.set_points
green, greens).set_points
red, reds).set_points
value, values)
bitmap.set_levels!(color_levels)
Now we end up with this.
color_levels.set_point
greens = {100 => 80, 150 => 135, 185 => 255}
reds = {205 => 105, 253 => 140, 255 => 160}
values = {135 => 170, 255 => 140}
color_levels.set_points
bitmap.set_levels!(color_levels)
Code:

color_levels = Color_Levels.new
greens = {85 => 140, 165 => 140, 185 => 50, 255 => 50}
values = {0 => 170, 60 => 170, 145 => 50, 200 => 130, 255 => 130}
color_levels.set_points
green, greens)
color_levels.set_points
value, values)
bitmap.set_levels!(color_levels)
Prepare yourself, it's not pretty.
greens = {85 => 140, 165 => 140, 185 => 50, 255 => 50}
values = {0 => 170, 60 => 170, 145 => 50, 200 => 130, 255 => 130}
color_levels.set_points
color_levels.set_points
bitmap.set_levels!(color_levels)
Code:

Additional Notes
This should theoretically work for VX and earlier but I do not have a way of testing it. If it doesn't work for VX, please let me know.
Download
DLL Download
http://www.4shared.c...rnbmcolors.html
Script
http://pastebin.com/AHheHtHC
Terms of Use
See script for terms of use.