
Zhris
Enthusiast
Feb 13, 2016, 10:25 AM
Post #2 of 2
(2625 views)
|
Re: [zurich] image encode base64 - help needed
[In reply to]
|
Can't Post
|
|
Hi, Could you provide a standalone version of your script that represents the problem. Using the below standalone version, I do not encounter the same issue i.e. input and output images are identical and not corrupted:
use strict; use warnings; use MIME::Base64; my $input_filepath = 'input.png'; my $output_filepath = 'output.png'; open my $input_filehandle, '<', $input_filepath or die $!; my $string = do { local $/ = undef; <$input_filehandle> }; close $input_filehandle; my $string_encoded = encode_base64( $string ); my $string_decoded = decode_base64( $string_encoded ); open my $output_filehandle, '>', $output_filepath or die $!; binmode $output_filehandle; print $output_filehandle $string_decoded; close $output_filehandle; Chris
|