Thread Tk::Photo - Data konvertieren (Base64) (13 answers)
Opened by Kean at 2011-06-15 13:42

topeg
 2011-06-15 14:10
#149626 #149626
User since
2006-07-10
2611 articles
BenutzerIn

user image
Also der String sieht mir nach Base64 Kodiert aus.

so kann man das handhaben:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl
use strict;
use warnings;
use Image::Magick;
use MIME::Base64;

# Create test Image
my $img = Image::Magick->new();
$img->Set(size=>'20x20');
$img->ReadImage('xc:white');
$img->Annotate( text => '?', family => 'Arial', stroke => 'black', pointsize => 20, x => 4, y => 17 );


# serialize Image als base64 coded GIF
my $data=encode_base64($img->ImageToBlob(magick => 'gif'));

# test print
print $data;

# read Image from string
my $img2=Image::Magick->new();
$img2->BlobToImage(decode_base64($data));

#test output
$img2->Display();

View full thread Tk::Photo - Data konvertieren (Base64)