Report a problem when processing large jp2 image.

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

Report a problem when processing large jp2 image.

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Report a problem when processing large jp2 image.

Post by magick »

The ImageMagick current release and subversion repository calls tmpnam() in jas_stream.c. Where are you seeing _snprintf()?
jstph
Posts: 31
Joined: 2011-01-27T10:07:43-07:00
Authentication code: 8675308

Re: Report a problem when processing large jp2 image.

Post by jstph »

I am using ImageMagick-windows which is 6.8.4, it has commented out the tmpnam and replaced with that strange _snprintf().
Post Reply