convert: Memory allocation failed

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
5f4gAeul

convert: Memory allocation failed

Post by 5f4gAeul »

I need to convert a bmp-file (1,97 Gb (2 120 108 598 byte) to tiff format: "C:\>convert -monitor dm19.bmp -define tiff:rows-per-strip=1 -depth 8 -type Palette -compress RLE dm19.tif". But my result is:
convert: Memory allocation failed `dm19.bmp'.
convert: missing an image filename `dm19.tif'.


What should I do?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert: Memory allocation failed

Post by magick »

Add -limit memory 1mb -limit map 1mb to your command line. If that fails, post a URL to your image so we can download and attempt to reproduce the problem.
5f4gAeul

Re: magick

Post by 5f4gAeul »

Fails:
C:\Downloads>convert -monitor dm19.bmp -limit memory 1mb -limit map 1mb -define tiff:rows-per-strip=1 -depth 8 -type Palette -compress RLE dm19.tif
convert: Memory allocation failed `dm19.bmp'.
convert: missing an image filename `dm19.tif'.

I'll post an URL to my image soon.
5f4gAeul

Re: magick

Post by 5f4gAeul »

Hi! I've uploaded the tiff-file: dm19.rar You should click green button «Скачать» but before type digits shown above it. After downloading you nedd to unrar the file.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert: Memory allocation failed

Post by magick »

The problem is that the majority of the ImageMagick coders (e.g. pnm, tiff, miff, etc) allocate one or two scanlines in memory, however, the BMP coders tries to allocate the entire image. We will need to improve the algorithm to only read a scanline at a time so that large BMP image files can be processed. We did try your image on a Linux server with plenty-o-memory and it converted successfully.
5f4gAeul

Re: convert: Memory allocation failed

Post by 5f4gAeul »

Unfortunately I don't have Linux server with plenty-o-memory. Will it work on PowerPC MacBook Pro with 2 Gb RAM? When will you improve the algorithm to only read a scanline at a time so that large BMP image files can be processed?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: convert: Memory allocation failed

Post by magick »

It may be sometime before we refactor the BMP coder. In the mean time if you have to convert a few images as a one time thing we can do that for you. If you have to do this often you may want to use some other program other than ImageMagick.
5f4gAeul

Re: magick

Post by 5f4gAeul »

to convert a few images as a one time thing we can do that for you
Thank you but it is not convinient for me. Could you please say about the size limit of bmp-files and tiff-files? If i try to reduce bmp-file size and increase their quantity will I be able to merge them (after converting) together as a tiff? I suppose that target file will be about 15 Gb. Could you please check my convert command for tiff as follows:

256 colors
Strips, with 1 scanline per strip
Packbits compression

Is "Convert -monitor dm19.bmp -define tiff:rows-per-strip=1 -depth 8 -type Palette -compress RLE dm19.tif" OK?
Post Reply