I'm trying to create a perl script which encodes images to base64. This shall be used to transfer images via xml to another system.
I created the following script to read the capture.png file:
use MIME::Base64; open (my $image, 'Z:\capture.png') or die "$!"; $raw_string = do{ local $/ = undef; <$image>; }; $encoded = encode_base64( $raw_string );
For the beginning, I just re-write into a new file photo.png
my $decoded= MIME::Base64::decode_base64($encoded); open my $fho, '>', 'Z:\photo.png' or die $!; binmode $fho; print $fho $decoded;
The photo.png is created with exactly the same size as the input photo, however the newly created file can't be opened.
I also comared the base64 value with the value created by an online encoding webpage (using the same input photo) and this is different.
I would be very happy if somebody could help me out with this!
Thanks a lot in advance. Best regards zurich
In reply to image encode base64 - help needed by zurich
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |