Robert Munteanu
Robert Munteanu

Reputation: 68268

From JPEG data to a complete JPEG file

I am currently parsing a PDF file using iText, and I encountered an image format which is not supported:

com.itextpdf.text.exceptions.UnsupportedPdfException: The filter /JPXDecode is not supported.

It seems that the information in the raw byte array is JPEG data, without the header information, as the file command line utility indicates:

83.jpg: JPEG 2000 image data

My first idea would be to simple add the header metadata to these files, but I simply don't know how.

How can I add the header metadata to a raw piece of JPEG 2000 data ? A solution using iText would work as well.

Upvotes: 3

Views: 894

Answers (1)

Jimmy
Jimmy

Reputation: 6171

The PDF spec (Section 7.4.9 JPXDecode Filter) seems to imply that the byte array is already a fully fledged JPEG2000 file. Have you tried just saving the byte array out to file with .jp2 or jpx extension?

Upvotes: 6

Related Questions