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
Spoiler
Let us say our original bitmap is the RPGMaker cloak, blown up for better viewing.


Code:
We'll end up with something like this.bitmap.colorify!( Color.new(200, 100, 0, 255) )Spoiler

Spoiler

Code:
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.bitmap.colorify_masked!( Color.new(200, 50, 50, 255), bitmapmask, false )Spoiler

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.
Spoiler
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)

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)
Code:
Now we end up with this.
Spoiler
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)

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)
Code:
Prepare yourself, it's not pretty.
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.