17#define JP2_RFC3745_MAGIC "\x00\x00\x00\x0c\x6a\x50\x20\x20\x0d\x0a\x87\x0a"
18#define JP2_MAGIC "\x0d\x0a\x87\x0a"
19#define J2K_CODESTREAM_MAGIC "\xff\x4f\xff\x51"
25void Jpeg2000::applyImageTweaks (
opj_image_t *image)
const
32 image->numcomps == 3 &&
33 image->comps[0].dx == image->comps[0].dy &&
34 image->comps[1].dx != 1) {
36 }
else if (image->numcomps <= 2) {
40 if (image->icc_profile_buf) {
41#if defined(OPJ_HAVE_LIBLCMS1) || defined(OPJ_HAVE_LIBLCMS2)
44 free (image->icc_profile_buf);
45 image->icc_profile_buf = 0;
46 image->icc_profile_len = 0;
70int Jpeg2000::getFileFormat(
const char *
filename)
const
72 static const char *
extension[] = {
"pgx",
"pnm",
"pgm",
"ppm",
"bmp",
73 "tif",
"raw",
"rawl",
"tga",
"png",
74 "j2k",
"jp2",
"jpt",
"j2c",
"jpc"};
84 for (
unsigned int i = 0;
i <
sizeof(format)/
sizeof(*format);
i++) {
113int Jpeg2000::inputFormat(
const char *
filename)
const
118 unsigned char buf[12];
146 magic_s =
".j2k or .jpc or .j2c";
158 <<
"The extension of this file is incorrect. Found " <<
s
175 QStringList::iterator
itr;
181 Qt::CaseInsensitive)) {
196 <<
" filename=" <<
filename.toLatin1().data();
198 if (invalidFileExtension (
filename)) {
262 applyImageTweaks (image);
267 buffer.open (QBuffer::WriteOnly);
295QStringList Jpeg2000::supportedFileExtensions ()
const
300 extensions <<
"j2k" <<
"jp2" <<
"jpc" <<
"jpt";
310 QStringList::iterator
itr;
const int INNER_RADIUS_MIN
void warningCallback(const char *msg, void *)
void infoCallback(const char *msg, void *)
void errorCallback(const char *msg, void *)
void color_sycc_to_rgb(opj_image_t *img)
void color_apply_icc_profile(opj_image_t *image)
int imagetopnm(opj_image_t *image, QBuffer &buffer)
#define JP2_RFC3745_MAGIC
#define J2K_CODESTREAM_MAGIC
log4cpp::Category * mainCat
QStringList supportedImageWildcards() const
List the supported jpeg2000 file extensions, for filtering import files.
bool load(const QString &filename, QImage &image) const
Load image from jpeg2000 file.
Jpeg2000()
Single constructor.
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_ERROR_S(logger)