Page 1 of 1

convert tif to jp2 results in un-parseable file

Posted: 2012-10-10T16:15:39-07:00
by tsoleau
I am trying to use the ImageMagick JPEG-2000 Image Format options to convert a tif to a jp2.

I used this page (http://www.imagemagick.org/script/jp2.php) to formulate a command similar to their example for lossless encoding - so:

$ convert input.tif -define numrlvls=6 -define jp2:tilewidth=1024 -define jp2:tileheight=1024 -define jp2:rate=1.0 -define jp2:lazy -define jp2:prg=rlcp -define jp2:ilyrrates='0.015625,0.01858,0.0221,0.025,0.03125,0.03716,0.04419,0.05,0.0625, 0.075,0.088,0.1,0.125,0.15,0.18,0.21,0.25,0.3,0.35,0.4,0.5,0.6,0.7,0.84' -define jp2:mode=int output.jp2

However, the resulting file has some issue because I can't open it with Photoshop - getting error "File format module cannot parse the file"

I also tried to just convert input.tif output.jp2 and a couple of other commands and they all resulted in files that give me the same Photoshop error.

I even tried converting the file to bmp before converting it to jp2 and got the same error.

Here are the details about my environment.

Version: ImageMagick 6.6.1-10 %F Q16
Platform: Unix
API: Shell

Does anyone have any suggestions for making valid jp2 files in ImageMagick from tifs? For a couple of years we were using Awares j2kdriver command to make the files, but we started having problems with some files producing segmentation errors (and sometimes dumping core!) and we couldn't figure out why so we're trying to just use ImageMagick commands to simplify things.

Thanks for any recommendations you have!
~Teresa

Re: convert tif to jp2 results in un-parseable file

Posted: 2012-10-10T17:01:20-07:00
by fmw42
Did you install the Jasper Delegate library?

Re: convert tif to jp2 results in un-parseable file

Posted: 2012-10-29T15:01:11-07:00
by tsoleau
Sorry about the delayed response (I was away from work).

One question about installing the jasper library - can we install Jasper and then ImageMagick on a box using the Binary install and have it work together? Or will we need to install ImageMagick from source?

Thanks,
~Teresa

Re: convert tif to jp2 results in un-parseable file

Posted: 2012-10-29T15:23:22-07:00
by fmw42
I am not an expert on this. All I can say is that I know that on my Mac, if I install the Jasper delegate (via Macports) and then compile IM manually from source (not from MacPorts), I can create and display a JP2 image. But when I do the following:

convert logo: logo.tif
convert logo.tif JP2:logo.jp2
display logo.jp2

It displays fine in IM.

It also opens fine in a Mac Viewer called GraphicConvert and Mac Preview.

But when I try to drop the file on a very old PS CS (PS 8), I get an error that it is not the correct format. If I try to open, it from PS, it is not in a format that is recognized as the filename is grayed out. If I try to force it to open it, I get a window asking for all kinds of information about the file. So it would appear to me that perhaps PS does not know how to deal with jp2 files?

My old version of PS does not have a JP2 or JP2000 format in the save or export dialog! Does your version of PS allow you to save to JP2 or JP2000?

Re: convert tif to jp2 results in un-parseable file

Posted: 2012-10-29T15:34:55-07:00
by tsoleau
Yes. I can save as jp2, open jp2 files, etc. in my version of Photoshop. Thanks to your suggestions, at this point I'm thinking it's that I don't have the Jasper delegate library installed with my imageMagick and I wanted more information about how I might go about doing that. Thanks.

Re: convert tif to jp2 results in un-parseable file

Posted: 2012-10-29T20:25:00-07:00
by fmw42
The only way I know (which may not be the only way), is to download and compile Jasper (see http://www.ece.uvic.ca/~frodo/jasper/) and then install IM manually. I do not know how to link the JP2000 delegate to a binary.