#! perl -slw
use strict;
use GD;
our $A ||= 45;
my $imgIn = GD::Image->new( $ARGV[ 0 ] ) or die $!;
my $cx = int $imgIn->width / 2;
my $cy = int $imgIn->height /2;
my $imgOut = GD::Image->new( $imgIn->getBounds, 1 );
$imgOut->copyRotated( $imgIn, $cx, $cy, 0, 0, $imgIn->getBounds, $A );
(my $ofile = $ARGV[0]) =~s[(\..*?$)][.r$A$1];
open OUT, '>:raw', $ofile or die $!;
print OUT $imgOut->png;
close OUT;
system $ofile;
####
libgd 2.0.33 or higher required for copyRotated support at ...
####
void
gdcopyRotated(dst,src,dstX,dstY,srcX,srcY,srcW,srcH,angle)
GD::Image dst
GD::Imagesrc
double dstX
double dstY
int srcX
int srcY
int srcW
int srcH
int angle
PROTOTYPE: $$$$$$$$$
CODE:
{
#ifdef VERSION_33
gdImageCopyRotated(dst,src,dstX,dstY,srcX,srcY,srcW,srcH,angle);
#else
die("libgd 2.0.33 or higher required for copyRotated support");
#endif
}