-
-$nimg=$img->crop(top=>10, left=>10, bottom=>25, right=>25)
- or skip ( "\# warning ".$img->{'ERRSTR'}."\n" );
-
-# xopcodes=>[qw( x y Add)],yopcodes=>[qw( x y Sub)],parm=>[]
-
-print "ok 2\n";
-$nimg->write(type=>'pnm',file=>'testout/t65.ppm') || die "error in write()\n";
-
-print "ok 3\n";
+{ # https://rt.cpan.org/Ticket/Display.html?id=7578
+ # make sure we get the right type of image on crop
+ my $src = Imager->new(xsize=>50, ysize=>50, channels=>2, bits=>16);
+ isx($src->getchannels, 2, "check src channels");
+ isx($src->bits, 16, "check src bits");
+ my $out = $src->crop(left=>10, right=>40, top=>10, bottom=>40);
+ isx($out->getchannels, 2, "check out channels");
+ isx($out->bits, 16, "check out bits");
+}
+{ # https://rt.cpan.org/Ticket/Display.html?id=7578
+ print "# try it for paletted too\n";
+ my $src = Imager->new(xsize=>50, ysize=>50, channels=>3, type=>'paletted');
+ # make sure color index zero is defined so there's something to copy
+ $src->addcolors(colors=>[Imager::Color->new(0,0,0)]);
+ isx($src->type, 'paletted', "check source type");
+ my $out = $src->crop(left=>10, right=>40, top=>10, bottom=>40);
+ isx($out->type, 'paletted', 'check output type');
+}