Thread Image::Magick - Logo in Bild einfügen (15 answers)
Opened by jan99 at 2013-08-16 14:28

GwenDragon
 2013-08-22 15:50
#169697 #169697
User since
2005-01-17
14748 Artikel
Admin1
[Homepage]
user image
Schau dir doch mal bitte meinen Beispielcode an, ich kann zwei Bilder und Text ins Overlay reinsetzen und dann mit der Karte kombinieren (siehe ins Zip mit den Testbildern 1MByte).

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/perl

use 5.008;
use strict;
use warnings;

use Image::Magick;

my $w;

my $karte = Image::Magick->new();
$w = $karte->ReadImage('karte.png');
die $w if $w;

my $overlay = Image::Magick->new();
$w = $overlay->Set( size => '800x600' );
die $w if $w;
$w = $overlay->ReadImage('xc:none');
die $w if $w;

my $globe = Image::Magick->new();
$w = $globe->ReadImage('globe.png');
die $w if $w;

$w = $overlay->Composite(
    geometry => '10x10',
    image    => $globe,
    compose  => 'over'
);
die $w if $w;

$w = $overlay->Annotate(
    text      => 'Karte 1',
    font      => 'arialb.ttf',
    fill      => 'blue',
    pointsize => '36',
    geometry  => '+400+50'
);
die $w if $w;

my $arrow = Image::Magick->new();
$w = $arrow->ReadImage('arrow.png');
die $w if $w;

$w = $overlay->Composite(
    geometry => '+700+10',
    image    => $arrow,
    compose  => 'over'
);
die $w if $w;

$w = $overlay->Annotate(
    text      => '(c)2134 Copyleft by Prof.Gwen.Dr.Agon',
    font      => 'ariali.ttf',
    fill      => 'black',
    pointsize => '24',
    geometry  => '+10+600'
);
die $w if $w;

$w = $karte->Composite(
    geometry => '+10+10',
    image    => $overlay,
    compose  => 'over'
);
die $w if $w;

$w = $karte->Write('demo.jpg');
die $w if $w;

Anhänge
application/zip
ovl.zip

Last edited: 2013-08-22 15:52:13 +0200 (CEST)

View full thread Image::Magick - Logo in Bild einfügen