import from https://code.google.com/p/jpeg-like-codec/ and https://code.google.com/p/jpeg2000-like-codec/