bpl = format->bpp*fmt->fmt.pix.with / 8; imagesize = bpl ? bpl * fmt->fmt.pix.height:fmt->fmt.pix.sizeimage;