/[cvs]/joko/public_html/test/Autodia/zoom
ViewVC logotype

Annotation of /joko/public_html/test/Autodia/zoom

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sun Mar 9 18:13:11 2003 UTC (21 years, 8 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
+ initial commit

1 joko 1.1 #!/usr/bin/perl
2    
3     use strict;
4     use warnings;
5    
6     use Data::Dumper;
7    
8    
9     my $in = 'glib-04-full-tmp.png';
10     my $out = {
11     file => 'glib-04-full-tmp-resampled.png',
12     prefix => '',
13     height => '',
14     width => '',
15     factor => 1/4,
16     };
17    
18    
19     my @ins;
20     while (<STDIN>) {
21     chomp;
22     push @ins, $_;
23     }
24    
25     print Dumper(@ins);
26     exit;
27    
28    
29    
30     use GD;
31    
32     # @google resize images w/o sacrificing quality
33     # @link http://www.webmasterworld.com/forum13/1597.htm
34    
35     # default to create true color images
36     GD::Image->trueColor(1);
37    
38    
39    
40    
41     my $s_im = GD::Image->new($in);
42    
43     (my $s_width, my $s_height) = $s_im->getBounds();
44     #print "width: ", $width, "\n";
45     #print "height: ", $height, "\n";
46    
47     $out->{width} = $s_width;
48     $out->{height} = $s_height;
49    
50     if (my $f = $out->{factor}) {
51     $out->{width} *= $f;
52     $out->{height} *= $f;
53     }
54    
55    
56     my $t_im = GD::Image->new($out->{width}, $out->{height});
57    
58     #$image->copyResampled($sourceImage,$dstX,$dstY,$srcX,$srcY,$destW,$destH,$srcW,$srcH)
59     $t_im->copyResampled(
60     $s_im,
61     0, 0, 0, 0,
62     $out->{width}, $out->{height}, $s_width, $s_height
63     );
64    
65    
66     my $out_payload = $t_im->png;
67     open(FH, '>' . $out->{file});
68     binmode FH;
69     print FH $out_payload;
70     close (FH);
71    
72     print "ready.", "\n";
73    
74     1;
75     __END__
76    

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed