@@ -512,7 +512,11 @@ class Pixels {
public function toPNG( ?level = 9 ) {
var png;
setFlip(false);
- switch( format ) {
+ if( offset != 0 ) {
+ bytes = bytes.sub(offset, calcDataSize(width,height, format));
+ offset = 0;
+ }
+ switch( format ) {
case ARGB:
png = std.format.png.Tools.build32ARGB(width, height, bytes #if (format >= "3.3") , level #end);
default: