in reply to batch rgb brightness and contrast adjustment

A comment on this script was made to me thru email, and so I'll post it here in case in may help someone looking at this snippet.

edada wrote:

Hi, I had some problems changing brightness with Imager using your code :

my @redmap = map { int( $r * $_) } 0..255; my @greenmap = map { int( $g * $_) } 0..255; my @bluemap = map { int( $b * $_) } 0..255; [..] $newimg->map( red=>\@redmap, green=>\@greenmap, blue=>\@bluemap ); $newimg->filter(type=>'contrast', intensity=> $c);
In Imager::Filters doc I can read that the contrast filter "scales each channel by intensity. Values of intensity < 1 will reduce the contrast". Your map do the same if $r => $b => $g ! It's supposed to change brightness and not contrast. I simply recommand you writing it with a :
my @redmap = map { int( $r + $_) } 0..255;
and using null value as default value.

I'm not really a human, but I play one on earth. flash japh