Gif processor crashes

Bokor Márton <[email protected]>
Newsgroups gmane.comp.video.image-magick.bugs
Message-ID <[email protected]>
I was getting access violations (in gif related dll) while batch converting and saving emf to gif on Windows XP. It happened quite frequently after about 100th saving. The only reason I believe it is a bug is that it does not happen with jpg. In my testcase I was very  low on physical memory, practically the full conversion went in virtual memory. Average size of emf is 100KB. Here is the crashing code in JMagick:

for (int i = 0; i < files.length; i++) { 

                                                               File srcFile = new File(gifFolder + "/" + files[i]); //about 20 100KB files here

                                                               

                                                               if (srcFile.exists()) {        

                                                                              System.out.println("ImageMagick: processing " + srcFile.getAbsolutePath());

                                                                              ImageInfo info = new ImageInfo( srcFile.getAbsolutePath() );

                                                                              info.setDensity("300");                                                                                                                                             

                                                               MagickImage image = new MagickImage( info );                                                                                            

                                                                                                                              

                                                               String gifFile = gifFolder + "/big_" + files[i].replaceAll("\\.EMF", ".gif"); //wonr crash with .jpg

                                                               System.out.println("ImageMagick: processing " + gifFile);

                                                               image = image.scaleImage(960, 720);

                                                               image.setFileName(gifFile);                                                                     

                                                                              image.writeImage(new ImageInfo(gifFile));

                                                                              

                                                                              gifFile = gifFolder + "/" + files[i].replaceAll("\\.EMF", ".gif");

                                                                              System.out.println("ImageMagick: processing " + gifFile);

                                                                              image = image.scaleImage(640, 480);

                                                                              image.setFileName(gifFile);       

                                                                              image.writeImage(new ImageInfo(gifFile));

 

                                                                              gifFile = gifFolder + "/small_" + files[i].replaceAll("\\.EMF", ".gif");

                                                                              System.out.println("ImageMagick: processing " + gifFile);

                                                                              image = image.scaleImage(90, 65);

                                                                              image.setFileName(gifFile);       

                                                                              image.writeImage(new ImageInfo(gifFile));

                                                                              image.destroyImages();

                                                               }

                                               }

I have already rewrote my code to jpg because of this, but I hope someone can reproduce it and fix it. In my oppinion there is a minor memory leak in the gif related codes.

Marton Bokor
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.