• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Access violation when converting large (>90 Mb) BMP files to JPEG2000

Started by kusdogan, 4 November 2009, 04:19:58

Previous topic - Next topic

kusdogan

below code gives access violation if fSource is a bmp file larger than 90 mb (i last tried with 115 mb) and fDest is jp2.  Is it because of TSingleImage ? It works very good for all other bmp files.

Imaging Library Version: 0.26.4
Compiler: Delphi 2007
OS: Windows Vista Ultimate



var
    mImage: TSingleImage;
begin
   fSource := 'C:\x.bmp';
   fDest := 'C:\x.jp2';

    mImage := TSingleImage.Create;
    mImage.LoadFromFile(fSource);

    Imaging.SetOption(ImagingJpeg2000LosslessCompression, 1);

    try
      mImage.SaveToFile(fDest);
    finally
      mImage.Free;
    end;

end;

Galfar

So unfortunately the exception is raised inside OpenJpeg library, so finding out what's wrong will be more difficult.  I'll check their forums if someone encountered error like this before.

kusdogan

I checked it from OpenJPEG web site and realized that library does not support 32b BMP files. After i convert it to 24b it worked. It was not related with size.

kusdogan

let me make a correction. it's also related with size. If image file is 32b and greater than 90MB, it fails.

Galfar

I've tried compressing 100+ MB large images in C++ program so I could see better where OpenJpeg fails - it was always some memory allocation function. OpenJpeg uses a lot of memory for images. For each channel Width*Height*SizeOf(Integer) large buffer is used. So for 100MB 24bit bitmap it's 400MB of buffers. There's also additional memory used to store compressed image. So basically you run out of free memory.   

This all should be fixed in OpenJpeg version 2 (unfortunately still looks like far future).

QuoteI checked it from OpenJPEG web site and realized that library does not support 32b BMP files. After i convert it to 24b it worked. It was not related with size.


You can store 1bit as well as 1024bit per pixel images in JPEG2000, so 32bits are not a problem for OpenJpeg.
24b image only used less memory.

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name:
Email:

Shortcuts: ALT+S save/post or ALT+P preview

SMF spam blocked by CleanTalk