I need to convert TIFFs that are 1GB large and have 4 channels to JPG2000. I am using ImageMagick-6.6.2-4-Q16-windows-x64-static on a Windows 7 64-bit machine with 8GB RAM. The conversion runs through without any error message, however the resulting JP2 file is 0kB large and there are 4 scratch files in the root directory each 250MB. I have tried this with the same results on about 30 different and similar files. I can supply a sample file via FTP.
Any sugegstions are much aprpeciated (I have to convert ~200 of these aerial images).
1GB 4-channel tif to jpg2000
Re: 1GB 4-channel tif to jpg2000
Post a URL to your image and the exact command you are using. We need to reproduce the problem before we can comment.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: 1GB 4-channel tif to jpg2000
Is the problem the file size or JP2? Can you create JP2 files from smaller images? Can you convert these large images to other formats?
1 GB is too large for my broadband, so I won't be able to test this. Someone else might.
1 GB is too large for my broadband, so I won't be able to test this. Someone else might.
snibgo's IM pages: im.snibgo.com
Re: 1GB 4-channel tif to jpg2000
The command I use:
convert in-file.tif -define jp2:rate=1 out-file.jp2 (... need lossless)
This works with most(!) smaller files like ~200MB (not all though and I have not figured out why).
convert in-file.tif -define jp2:rate=1 out-file.jp2 (... need lossless)
This works with most(!) smaller files like ~200MB (not all though and I have not figured out why).
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: 1GB 4-channel tif to jpg2000
After some correspondence with Roman, here is a reproducible test case. (Creating a small JP2 works fine.)
Create a large input:
convert -size 16053x16053 xc:red bigred.png
convert bigred.png bigred.jpg
(This works.)
convert bigred.png bigred.jp2
convert: unable to create image `bigred.jp2' @ error/jp2.c/WriteJP2Image/878.
I have Windows 7, IM 6.5.2-4, on a 4 GB laptop. With the Windows Resource Monitor, I observe the memory filling up. When it is full, convert fails.
The convert also fails with variations of
-limit memory 1024mb
-limit map 1024mb
-limit area 1024mb
I suspect the conversion to JP2 might work with more memory. Am I missing something to make it work on a "small" computer?
Create a large input:
convert -size 16053x16053 xc:red bigred.png
convert bigred.png bigred.jpg
(This works.)
convert bigred.png bigred.jp2
convert: unable to create image `bigred.jp2' @ error/jp2.c/WriteJP2Image/878.
I have Windows 7, IM 6.5.2-4, on a 4 GB laptop. With the Windows Resource Monitor, I observe the memory filling up. When it is full, convert fails.
The convert also fails with variations of
-limit memory 1024mb
-limit map 1024mb
-limit area 1024mb
I suspect the conversion to JP2 might work with more memory. Am I missing something to make it work on a "small" computer?
snibgo's IM pages: im.snibgo.com
Re: 1GB 4-channel tif to jpg2000
Although ImageMagick can process one image scan line in memory at a time (if you force the pixel cache to disk with -limit area 1mb), the JP2 delegate library appears to want to allocate the entire image in memory. There are a number of JP2 options you can use, one which may reduce memory requirements. If you cannot find an option that works, contact the Jasper development team. Only they can resolve the memory issue.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: 1GB 4-channel tif to jpg2000
Thanks, magick.
I can't find a jp2 option that helps: nomct, rate, lazy etc.
I'll leave it to Roman to find a bigger computer or contact the Jasper team. Let us know how it goes, Roman.
I can't find a jp2 option that helps: nomct, rate, lazy etc.
I'll leave it to Roman to find a bigger computer or contact the Jasper team. Let us know how it goes, Roman.
snibgo's IM pages: im.snibgo.com
Re: 1GB 4-channel tif to jpg2000
We found a solution. The command
convert source.tif -define jp2:rate=1 -define jp2:tilewidth=256 -define jp2:tileheight=256 destination.jp2
works perfectly, even with my 2GB RAM laptop.Whew! Thank you all for your help and especially your quick response.
convert source.tif -define jp2:rate=1 -define jp2:tilewidth=256 -define jp2:tileheight=256 destination.jp2
works perfectly, even with my 2GB RAM laptop.Whew! Thank you all for your help and especially your quick response.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: 1GB 4-channel tif to jpg2000
Yup, I didn't try tilewidth and height, so they were bound to help. Sigh.
Glad you solved it, Roman.
Glad you solved it, Roman.
snibgo's IM pages: im.snibgo.com