seems to work fine pdf format strips the header and the tail of the jbig2 file as specified in PDF, Version 1.7 (ISO 32000-1:2008) section 7.4.7 JBIG2Decode Filter Further, some pdf files contain jbig2 streams with last segment of unspecified size (ff ff ff ff). libjbig2dec can not handle this.
procedure TJBIG2Bitmap.combine(bitmap: TJBIG2Bitmap; x, y: Integer; combOp: Int64);
srcWidth := bitmap.width;
srcHeight := bitmap.height;
srcRow := 0;
srcCol := 0;
if (x < 0) then x := 0;
if (y < 0) then y := 0;
for row := y to Min(y + srcHeight - 1, Self.height - 1) do // <<<<<<<< HERE
for col := x to x + srcWidth - 1 do
srcPixel := bitmap.getPixel(srcCol, srcRow);
Having ghostscript leave JBIG2 files alone
By : user3536162
Date : March 29 2020, 07:55 AM
should help you out There's no current way to have Ghostscript pass JBIG2 images unchanged. The pdfwrite device doesn't permit JBIG2Encode as a possible encoding method so you can't use that.