Added support for J2K encoding with libopenjpeg
Note: Some of the previous patches have had two bugs that have been fixed in this patch.