my $req = new CGI; $contentpic=$req->param("pic") if ($req->param("pic") ); if ( open ( PICTF,">somepath/image.jpeg" ) ) { binmode PICTF; print PICTF $contentpic; close (PICTF); my ($x, $y, $info) = imgsize("somepath/image.jpeg"); $info=lc($info); $info=~s/jpg/jpeg/; if ( $info eq "jpeg" ) { my $logo=Imager->new(); $logo->read(file =>"somepath/mylogo.png", type => 'png'); my $imgorg=Imager->new(); $imgorg->read(file => "somepath/image.jpeg", type => $info); my $img=$imgorg->scale(xpixels=>280); my ($tx,$ty)=((280-$logosize[0]-$logooffs),(int(280*$y/$x)-$logosize[1]-$logooffs)); $img->rubthrough( src=>$logo, tx=>$tx,ty=>$ty ); $img->write(file => "somepath/image.jpeg", type => $info); $result=1; }