my $headline = Imager->new(file => '/path/to/yapcjapan2018.png');
# y 370 793 423 px
# 0% 55%
# 1040x1
my $line = Imager->new(
xsize => 1040,
ysize => 1,
channels => 4, # alpha channel
);
$line->box(filled => 1, color => '#000000'); #
my $opacity = 0.00;
my $increment_per_line = (0.55 - $opacity) / 423; # 1 px
for my $y (370 .. 793) {
$headline->compose(
src => $line,
tx => 0,
ty => $y,
opacity => $opacity,
);
$opacity += $increment_per_line;
}
LINE NEWS DIGEST
#
my $tp = Imager->new(
xsize => 1040,
ysize => 794,
channels => 4, # alpha channel
);
#
my $title = 'YAPC::Japan ';
#
my $description = '2018 3 3 OIST@ Perl ';
#
$tp->string(
font => $hiragino_w6,
text => $title,
x => 36,
y => 684,
size => 70,
color => '#000000',
aa => 1,
);
$tp->string(
font => $hiragino_w3,
text => $description,
x => 36,
y => 748,
size => 40,
color => '#000000',
aa => 1,
);
# 43%
$headline->compose(src => $tp, tx => 0, ty => 0, opacity => 0.43);
LINE NEWS DIGEST
$headline->string(
font => $hiragino_w6,
text => $title,
x => 36,
y => 682,
size => 70,
color => '#ffffff',
aa => 1,
);
$headline->string(
font => $hiragino_w3,
text => $description,
x => 36,
y => 746,
size => 40,
color => '#ffffff',
aa => 1,
);
LINE NEWS DIGEST
my $img01 = Imager->new(file => '/path/to/ao-no-doukutsu.jpg');
my $line = Imager->new(
xsize => 386,
ysize => 1,
channels => 4,
);
$line->box(filled => 1, color => '#000000');
my $opacity = 0.00;
my $increment_per_line = (0.55 - $opacity) / 203;
for my $y (171 .. 374) {
$img01->compose(
src => $line,
tx => 0,
ty => $y,
opacity => $opacity,
);
$opacity += $increment_per_line;
}
my $tp = Imager->new(
xsize => 386,
ysize => 375,
channels => 4,
);
$tp->string(
font => $hiragino_w3,
text => ' ',
x => 36,
y => 338,
size => 40,
color => '#000000',
aa => 1,
);
$img01->compose(src => $tp, tx => 0, ty => 0, opacity => 0.43);
$img01->string(
font => $hiragino_w3,
text => ' ',
x => 36,
y => 336,
size => 40,
color => '#ffffff',
aa => 1,
);
LINE NEWS DIGEST
my @titles = (
‘ ’, ' ',
‘ ', ' ',
' ',
);
my @text_news;
for my $i (0 .. 4) {
my $text = Imager->new(xsize => 654, ysize => 150); #
$text->box(filled => 1, color => '#ffffff');
my $line = Imager->new(xsize => 654, ysize => 2); #
$line->box(filled => 1, color => '#dde0e6');
$text->paste(left => 0, top => 148, img => $line);
$text->string(
font => $hiragino_w3,
text => $titles[$i],
x => 36,
y => 91,
size => 41,
color => '#000000',
aa => 1,
);
push @text_news, $text;
}
LINE NEWS DIGEST
#
my $footer = Imager->new(xsize => 1040, ysize => 140);
$footer->box(filled => 1, color => '#ffffff');
my $arrow = Imager->new(file => '/path/to/arrow.png');
$footer->compose(src => $arrow, tx => 984, ty => 53);
$footer->string(
font => $hiragino_w6,
text => ' ',
x => 36,
y => 84,
size => 36,
color => '#284096',
aa => 1,
);
LINE NEWS DIGEST
#
my $base = Imager->new(xsize => 1040, ysize => 1824);
$base->box(filled => 1, color => '#ffffff');
$base->paste(left => 0, top => 0, img => $header);
$base->paste(left => 0, top => 140, img => $headline);
$base->paste(left => 0, top => 934, img => $img01);
$base->paste(left => 0, top => 1309, img => $img02);
my $y = 934;
for my $i (0 .. 4) {
$base->paste(left => 386, top => $y + $i * 150, img => $text_news[$i]);
}
$base->paste(left => 0, top => 1684, img => $footer);
LINE NEWS DIGEST