From a9049df5e952cf0a1aa143580b8935decf64b7fc Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 9 Oct 2014 11:36:17 -0400 Subject: white is max, not always 1 --- lib/Games/NES/SpriteMaker.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Games/NES/SpriteMaker.pm b/lib/Games/NES/SpriteMaker.pm index 4647303..c6a69bd 100644 --- a/lib/Games/NES/SpriteMaker.pm +++ b/lib/Games/NES/SpriteMaker.pm @@ -85,7 +85,8 @@ sub image_to_sprite { sub _get_palette_colors { my ($image) = @_; - my %unique_values = ("1;1;1" => 0); + my $max = $image->max_pixel_value; + my %unique_values = ("$max;$max;$max" => 0); my $idx = 1; for my $row (0..$image->height - 1) { for my $col (0..$image->width - 1) { -- cgit v1.2.3-54-g00ecf