Leser: 1
![]() |
![]() |
5 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Photo; use Tk::JPEG; my $mw = tkinit(); $mw->geometry( '600x845' ); my $image = './proxy.jpg'; my $photo = $mw->Photo( 'test', -height => 845, -width => 600, ); $photo->read( $image ); $mw->Label( -image => $photo )->pack; MainLoop;
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
#!/usr/bin/perl -w
use strict;
use Tk;
use Tk::JPEG;
use Tk::Photo;
use GD;
use MIME::Base64;
my $mw = tkinit(-title => 'Tests with Images');
main_gui($mw);
MainLoop;
### Subroutines ###
sub main_gui {
$mw = shift;
my $frame_left = $mw->Frame(-background => 'red', -width => 130, -height => 500);
my $frame_right = $mw->Frame(-background => 'blue', -width => 170, -height => 500);
my $frame_center = $mw->Frame(-background => 'yellow', -width => 500, -height => 400);
my $frame_bottom = $mw->Frame(-background => 'green', -width => 500, -height => 100);
$frame_left ->grid(-row => 0, -column => 0, -rowspan => 2);
$frame_right ->grid(-row => 0, -column => 2, -rowspan => 2);
$frame_center->grid(-row => 0, -column => 1);
$frame_bottom->grid(-row => 1, -column => 1);
my $image_data = newFromJpeg GD::Image('DSCF0334.JPG') || die $!;
$image_data->flipVertical();
$image_data = encode_base64( $image_data->jpeg(100) );
my $image = $frame_center->Photo(-data => $image_data );
my $small_foto = $mw->Photo;
$small_foto->copy($image, -subsample => 5,5);
$image->blank();
$frame_center->Label( -image => $small_foto )->pack();
}
![]() |
![]() |
5 Einträge, 1 Seite |