Sam Howard FollowSam is a developer at IDRsolutions who mostly specialises in font support and conversion. He's also enjoyed working with Java 3D, Java FX and Swing. His other interests include music and game design.

3 big changes in JPedal JBIG2 Decoder version 3

March 29, 2013 1 min read

In Part 1 of a series of articles regarding the JPedal Version 5.X update we explore the big changes that this update will bring.

As we mentioned a few weeks ago on this blog, April will see the release of Version 5 of our JPedal PDF library, which will contain version 3 of our JBIG2 decoder.

JBIG2 is a format for encoding bi-level (which usually means black and white) images. When writing our PDF library, we realised that none of the standard Java libraries – or any other Java libraries – could handle JBIG2 data, so we developed our own in 2008 and released it under a BSD license.

That was a long time ago now, but we followed it up in 2010 with version 2, which included a bunch of fixes and massive speed improvements. Unlike version 1, we kept it in-house as an exclusive part of our PDF library. Version 1 is still used by some of our competitors – we occasionally get bug reports from users complaining the images work in our viewer but not theirs. (We recommend a simple fix for this!)

With version 3 we set ourselves 3 main targets:-

1. More speed. Back in 2008 we were maintaining compatibility with Java 1.4. Java’s come a long way since then, and we’ve taken advantage of the new features to make our code cleaner and faster. We’ve also continued profiling to find and deal with bottlenecks.

2. More robust. We have seen an increasing number of PDF files where the JBIG2 data is unusual, incorrect or corrupt. We have added a lot of code to recover from these issues as elegantly as possible.

3. More comprehensive. JBIG2 is a complex format, and the specification has a lot of rarely used features. As we’ve come across more files we’ve been able to add support for more of these – in this release we’ve added support for custom Huffman tables, which is an increasingly popular technique for better compressing the image data.

We are very pleased with the results. Again, we’ve kept these changes in-house and we hope you find them worthwhile in the next update.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (Twitter, Facebook and Google+) or the Blog RSS.

Sam Howard FollowSam is a developer at IDRsolutions who mostly specialises in font support and conversion. He's also enjoyed working with Java 3D, Java FX and Swing. His other interests include music and game design.