# Convert to Image::Maggick image
my $pic = Image::Magick->new(magick=>'jpg'); # create new image object
$pic->BlobToImage($img); #convert the grabbed blob image to Image::Magick object
## test point A
#pass the $pic object to the subroutine and measure image darkness.
my $test = ImageNotDark ($pic); #
####
sub ImageNotDark {
# Argument is one reference to an image object.
# ImageNotDark compares the image with a blank black canvas. If the comparison is
# above the defined threshold, the image is bright enough to send (not dark).
# the return value is true if the images is bright enough.
my $iutImage = Image::Magick->new; #the image tested for darkness
$iutImage->Read(@_); # get the image under test (iut)
####
sub ImageNotDark {
my ($iutImage,$arg2,$arg3,...) = @_;
# --OR--
my $iutImage = shift;
my $arg2 = shift;
...