Page 1 of 1
[SOLVED] Error convert JPEG-2000
Posted: 2013-05-31T01:08:58-07:00
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:
In the output folder I have an image .jp2 wich dimension is 0 byte.
Can anyone help me?
Thanks a lot
Re: Error convert JPEG-2000
Posted: 2013-05-31T01:12:12-07:00
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?
Re: Error convert JPEG-2000
Posted: 2013-05-31T07:45:19-07:00
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
Re: Error convert JPEG-2000
Posted: 2013-06-01T00:02:34-07:00
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
Re: Error convert JPEG-2000
Posted: 2013-06-01T02:16:11-07:00
by snibgo
Are you converting 1000 at once?
Code: Select all
convert *.tif -quality 95 pippo.jp2
Can you convert just one file?
Re: Error convert JPEG-2000
Posted: 2013-06-01T10:15:55-07:00
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
Re: Error convert JPEG-2000
Posted: 2013-06-02T02:06:20-07:00
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
Re: Error convert JPEG-2000
Posted: 2013-06-02T11:05:04-07:00
by fmw42
I do not have a large tif. Can you provide a link to one that fails?
Re: Error convert JPEG-2000
Posted: 2013-06-03T14:17:24-07:00
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).
Re: Error convert JPEG-2000
Posted: 2013-06-03T15:21:05-07:00
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
Re: Error convert JPEG-2000
Posted: 2013-06-03T23:46:19-07:00
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.
Re: Error convert JPEG-2000
Posted: 2013-06-04T01:13:46-07:00
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/
Re: Error convert JPEG-2000
Posted: 2013-06-04T01:16:49-07:00
by gazzateo
Thank you very much.
Re: Error convert JPEG-2000
Posted: 2013-06-04T02:14:45-07:00
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