Hi kaza_perl_ip, another option for Photo is to use base64 encoded data using the -data argument instead of the -file argument.
A solution I used was to store the base64 encoded value in a variable and pass it to the -data argument to Photo.
Untested sample foo code...
my $encodedImg = q{very long
multi line
multi line
multi line
multi line
multi line
multi line
multi line
multi line
multi line
multi line
multi line
encoded data};
my $can_encImg = $canvas->Photo( -data => $encodedImg );
Hope it helps!