[SOLVED] Error convert JPEG-2000

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
gazzateo
Posts: 12
Joined: 2013-05-31T00:46:44-07:00
Authentication code: 6789

[SOLVED] Error convert JPEG-2000

Post by gazzateo »

Good morning everyone.
I have some images (I think they are one thousand and half) that are in TIF format, RGB 16bit, 17310x11310 pixel.
With the convert tool I have now a new image, RGB 8bit.
I want to convert it in .jp2 format with high quality (-quality 95), but when I try to do this, imagemagick crash.
Command line report this error:

Code: Select all

Annullato (core dump creato)
In the output folder I have an image .jp2 wich dimension is 0 byte.

Can anyone help me?

Thanks a lot
Last edited by gazzateo on 2013-06-04T02:15:39-07:00, edited 1 time in total.
gazzateo
Posts: 12
Joined: 2013-05-31T00:46:44-07:00
Authentication code: 6789

Re: Error convert JPEG-2000

Post by gazzateo »

The command line that I've wrote to convert tif in jp2 is:

Code: Select all

user@COMPUTER:~/Documenti/Immagini$ convert *.tif -quality 95 pippo.jp2
Have I some mistake done?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error convert JPEG-2000

Post by snibgo »

17310x11310 pixels at 6 bytes/pixel is 1 GB of memory. One thousand of these is 1 TB of memory. Is your computer big enough?

See also http://www.imagemagick.org/script/archi ... tera-pixel
snibgo's IM pages: im.snibgo.com
gazzateo
Posts: 12
Joined: 2013-05-31T00:46:44-07:00
Authentication code: 6789

Re: Error convert JPEG-2000

Post by gazzateo »

Yes, my computer is big enough.
I have 4 Gb of memory, I work without X server started, so I can let free so much RAM.
When I have all the photos, I occupy 1,6 TB of HD, but this is not a problem.

I wrote a bash script that search tif image in a folder, and, if file exists, converts each photo in jp2.
The problem of enough RAM isn't real, I think.
I think that the conversion will use at most 2,4 GB of RAM (1,2 GB used to read the original image, 1,2 GB - at most - for transformed image), for each image.

Is there a limit to use the jp2 conversion?

Thanks for reply
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Error convert JPEG-2000

Post by snibgo »

Are you converting 1000 at once?

Code: Select all

convert *.tif -quality 95 pippo.jp2
Can you convert just one file?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error convert JPEG-2000

Post by fmw42 »

convert will load all the images before processing. do you have enough memory for both all the inputs and all the outputs? if not use mogrify. it will only access one image at a time.

see
http://www.imagemagick.org/Usage/basics/#mogrify
gazzateo
Posts: 12
Joined: 2013-05-31T00:46:44-07:00
Authentication code: 6789

Re: Error convert JPEG-2000

Post by gazzateo »

Thanks snibog and fmw42 for your answers.
Now I know another important feature abuot convert.
But even if I convert only one file, the program crashes.
(I've tryed just 10 min ago to do this)

However, the bash script process just only one file each time.

Can you try to convert a tif big enough?
If you are able to do this, I know the problem is about my computer. Otherwise the bug is in the "convert" command.

Thank you very much
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Error convert JPEG-2000

Post by fmw42 »

I do not have a large tif. Can you provide a link to one that fails?
gazzateo
Posts: 12
Joined: 2013-05-31T00:46:44-07:00
Authentication code: 6789

Re: Error convert JPEG-2000

Post by gazzateo »

Ok.
I can't send you a link to photos that I must convert; they are under hard restriction.
But you can download the Blue Marble 2012 at http://www.nasa.gov/images/content/6184 ... h_full.jpg

In any case, I think you can create one large tif using an up-scale of any image (but I'm not sure).
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Error convert JPEG-2000

Post by GreenKoopa »

So your problem is unrelated to reading in large numbers of files at once (as your original command shows)? And unrelated to tiff (as your example image is jpeg)? Help is easier to give if you can provide the simplest command that doesn't work, along with any images needed for others to reproduce the error. Here is mine:

Code: Select all

> convert -size 1500x1000 gradient:black-white -quality 95 out1.jp2
produces correct output

> convert -size 2000x1000 gradient:black-white -quality 95 out2.jp2
convert.exe: unable to create image `out2.jp2' @ error/jp2.c/WriteJP2Image/938.
creates out2.jp2, but 0 bytes

ImageMagick 6.8.5-6 2013-05-10 Q16 on Windows 7
gazzateo
Posts: 12
Joined: 2013-05-31T00:46:44-07:00
Authentication code: 6789

Re: Error convert JPEG-2000

Post by gazzateo »

To Greenkoopa: my problem is unrelated to open multiple images, you're right.
The first command line I wrote in this forum isn't precise.
I don't know if my problem is related to tif file - But I'm quiet sure it is related to a too big output .jp2 file.

The image I linked is the most large free image I remember. It is a jpg file, but you can convert it (or mogrify it).

Now I try to convert it in a tif file (I'm sure it works) only to re-create initial conditions of my problem.

Then convert it in jp2.
I may not resize the output image, only compress it (and only a little, to preserve the original quality).

Then I post here my results.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: Error convert JPEG-2000

Post by GreenKoopa »

JPEG-2000 has many options. They may be especially important for larger images.
http://www.imagemagick.org/script/jp2.php

Since I could reproduce your error with a simple test case, others have likely had this problem. Try searching the forums. Here is one topic I found:
1GB 4-channel tif to jpg2000
viewtopic.php?f=3&t=16472

ImageMagick delegates jp2 encoding/decoding to JasPer. Maybe they can help.
http://www.ece.uvic.ca/~frodo/jasper/
gazzateo
Posts: 12
Joined: 2013-05-31T00:46:44-07:00
Authentication code: 6789

Re: Error convert JPEG-2000

Post by gazzateo »

Thank you very much.
gazzateo
Posts: 12
Joined: 2013-05-31T00:46:44-07:00
Authentication code: 6789

Re: Error convert JPEG-2000

Post by gazzateo »

@Greenkoopa
I've tried to convert one of my tif image with parameters show in thread you have me said - (I think RomanK is a colleague) and it works fine!!!
Thank you very much.

Now I MUST learn to search something in a forum.....

Bye
Post Reply