#! 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;