Thread Einfache Graphik: Graphische Darstellung von Daten (5 answers)
Opened by mayper at 2005-10-06 17:12

renee
 2005-10-07 20:42
#44754 #44754
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Du kannst keine Grafiken auf einer Konsole anzeigen. Du müsstest also erst eine Bilddatei erzeugen und Dir diese dann anschauen... Dafür war Dein Code schon fast richtig:
Code: (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
26
#!/usr/local/bin/perl

use GD;

# create a new image
$im = new GD::Image(100,100);
# allocate some colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);
$red = $im->colorAllocate(255,0,0);
$blue = $im->colorAllocate(0,0,255);
# make the background transparent and interlaced
$im->transparent($white);
$im->interlaced('true');
# Put a black frame around the picture
$im->rectangle(0,0,99,99,$black);
# Draw a blue oval
$im->arc(50,50,95,75,0,360,$blue);
# And fill it with red
$im->fill(50,50,$red);
# make sure we are writing to a binary stream
# Convert the image to PNG
open(my $imagefh, ">test.png") or die $!;
binmode $imagefh;
print $imagefh $im->png;
close $imagefh;
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Einfache Graphik: Graphische Darstellung von Daten