Page 1 of 1

Report a problem when processing large jp2 image.

Posted: 2013-12-23T12:24:33-07:00
by jstph
Magik, Sorry for the multiple topics. I thought it will be easier for you to read.
here is the testing file
http://www.microimages.com/gallery/jp2/CB_TM_QQ432.jp2
I found a problem in Core_jp2 package. When process large jp2 image, jasper library will use disk file to store the color components value. However the process to create temporary file has problem.
the problem is locate In CORE_jp2
File jas_stream.c

jas_stream_t *jas_stream_tmpfile()
{…

/* Choose a file name. */
//tmpnam(obj->pathname);
/**
* this call try to create a temporary file, however it doestn’t always work */
_snprintf(obj->pathname, L_tmpnam, "%stmp-XXXXXXXXXX", P_tmpdir);


}
I understand why the developer want to replace the tmpnam. However his fix doesn’t always work, and also this call will be used in a loop to store multi-color components, which will definitely cause problem.
I uncommented the tmpname(obj->pathname) and removed the _snprintf(obj->pathname, L_tmpnam, "%stmp-XXXXXXXXXX", P_tmpdir) line, it worked for my purpose.

Re: Report a problem when processing large jp2 image.

Posted: 2013-12-23T12:54:04-07:00
by magick
The ImageMagick current release and subversion repository calls tmpnam() in jas_stream.c. Where are you seeing _snprintf()?

Re: Report a problem when processing large jp2 image.

Posted: 2013-12-23T13:05:16-07:00
by jstph
I am using ImageMagick-windows which is 6.8.4, it has commented out the tmpnam and replaced with that strange _snprintf().