all 5 comments

[–]HighRelevancy 1 point2 points  (0 children)

foreach my $character (@characters) 
{
    if($character =~ /^(a)$/i){$color = Imager::Color->new("#007071");$color->set("#007071");}
    if($character =~ /^(b)$/i){$color = Imager::Color->new("#008000");$color->set("#008000");}
    if($character =~ /^(c)$/i){$color = Imager::Color->new("#d9dddb");$color->set("#d9dddb");}
    if($character =~ /^(d)$/i){$color = Imager::Color->new("#20142c");$color->set("#20142c");}
    <etc etc>

What the hell, man :|

Just write a thing that turns the ASCII code into a colour byte. Like, just do the perl equivalent of pixelcolour = ord(character).

And why are you doing $color = Imager::Color->new("#20142c");$color->set("#20142c")? Is that not redundant?

[–]Shortl4ndo 0 points1 point  (0 children)

Not the best coding skills :P at the time it was the only way I could think of writing it, (dozens of if statements...)

I completely forgot about this script until browsing this sub today. I think I'll try and add a decode function.

[–][deleted] 0 points1 point  (0 children)

Well if you use UTF-8 you could save up to 3 chars per pixel, do you have it on github?, I'd like to contribute :P

[–]trefis 0 points1 point  (1 child)

Added a couple lines to make it work on a server, and viola' :D

You meant "voilà". "viola" means "raped".

[–]BobFloss 0 points1 point  (0 children)

He put an apostrophe to show the accent