#!/usr/bin/env perl use strict; use warnings; use Prima qw(Application MsgBox ImageViewer); # Example image taken from the "Astronomy Picture of the Day Archive" # http://apod.nasa.gov/apod/archivepix.html # Picture of the day May 13, 2016 # http://apod.nasa.gov/apod/ap160513.html my $im = Prima::Image->load('mercury-transit-2016-50legaultc.jpg'); my $sf = 1.2; # scaling factor my $w = $im->width; # image width my $h = $im->height; # image height my $wDisplay = Prima::MainWindow->create( text => 'Image Viewer', size => [ $sf*$w, $sf*$h ], ); $wDisplay->insert( 'Prima::ImageViewer', size => [ $w, $h ], image => $im, autoZoom => 1, onMouseDown => sub { my ( $self, $button, $mod, $x, $y) = @_; message("You clicked me at: $x:$y!"); } ); run Prima;