ICT role in 21st century education and its challenges
画像Hacks
1.
2.
3.
4.
5. use strict;
use warnings;
use Imager;
my $file = 'doya.jpg';
my $image = Imager->new( file => $file ) or die Imager->errstr;
$image = $image->scale( xpixels => 100 );
$image->write( file => 'out.jpg' ) or die $image->errstr;
6. ...;
my $image = Imager->new( file => $file ) or die Imager->errstr;
$image = $image->scale( xpixels => 100 );
$image = $image->crop( height => 100 ); #
$image->write( file => 'out.jpg' ) or die $image->errstr;
...;
7.
8.
9.
10.
11. sub get_map {
my $gamma = shift;
my @map =
map { int( 0.5 + 255 * ( $_ / 255 )**$gamma ) } 0 .. 255;
return @map;
}
$image->map(
red => get_map(0.5),
green => get_map(0.65),
blue => get_map(0.8)
);
my $waku = Imager->new( file => 'waku.png' );
$image->rubthrough( src => $waku );