Page 1 of 1
Converting Pyramidal TIFF to JPEG2000
Posted: 2012-10-05T11:16:54-07:00
by syamashi
Hello,
I'd like to convert Pyramidal TIFF to JPEG2000. However, the generated files are separated in to seven different files which I believe they are associated with the resolution levels. The following command worked for flat TIFFs to generate a single file:
% convert source_image -define numrlvls=7 -define jp2:tilewidth=1024 -define jp2:tileheight=1024 -define jp2:rate=0.02348 -define jp2:prg=rpcl -define jp2:mode=int -define jp2:prcwidth=1024 -define jp2:prcheight=1024 -define jp2:cblkwidth=64 -define jp2:cblkheight=64 -define jp2:sop output_image
Could anyone shed light on how to tweak the parameters so that I can prevent the output to generate a single consolidated file?
Thanks for your help,
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-10-10T16:43:37-07:00
by anthony
Code: Select all
convert image.tiff -delete 1--1 ....
The delete removes the second image (index 1) to the last image (index -1).
See IM Examples, Basics, Delete
http://www.imagemagick.org/Usage/basics/#delete
or
convert image.tiff"[0]" ....
See IM Examples, File Handling, Read modifiers
http://www.imagemagick.org/Usage/files/#read_mods
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-11-06T15:00:46-07:00
by syamashi
Hi anthony,
Thanks for you reply. That should work on what I intend to do. I also have two more question regarding this conversion and I hope you don't mind answering.
I'm attempting to convert a TIFF file which is 14000x11000 in size and the lowest resolution level of the JPEG2000 from previous convert command gives me "229x172" in size. However, I intend to get "106x79" for the lowest resolution level. I've tried tweaking the parameters but none of them seem to get as I expect. For example, I've tried various "numrlvls" from 6~9. Is there anyway I can tweak the parameters to get much smaller size of lowest resolution level? The other question is, does ImageMagick has a command to get basic information of the JPEG2000 file? For example, I'd like to extract how many resolution levels are there and what sizes for each level.
thanks,
syamashi
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-11-08T15:49:50-07:00
by fmw42
Perhaps there is some automatic padding that you will not be able to remove, or there is some virtual-canvas created that is larger than you expect. For the latter, try adding +repage before the output.
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-11-09T09:52:56-07:00
by syamashi
Hi,
I tried with "+repage" option but that didn't help. The lowest resolution level comes out in "229x172". Here is the command I'm running:
Code: Select all
convert input.tif -define jp2:numrlvls=7 -define jp2:tilewidth=1024 -define jp2:tileheight=1024 -define jp2:rate=0.02348 -define jp2:prg=rpcl -define jp2:mode=int -define jp2:prcwidth=1024 -define jp2:prcheight=1024 -define jp2:cblkwidth=64 -define jp2:cblkheight=64 -define jp2:sop +repage output.jp2
Is there a way to know the dimensions of each level?
thanks,
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-11-09T11:43:21-07:00
by fmw42
idenify -verbose yourimage
should tell you everything about each level
If you just want the wxh you can do
convert yourimage -format "%w x %h" info:
and it should list that information for each level
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-11-09T13:09:18-07:00
by syamashi
Interestingly, I was not able to list the dimensions with one consolidated JPEG2000 file as opposed to what listed with Pyramidal TIFF file. However, I managed to print the dimensions of individually generated files and they appeared to be the same dimensions.
thanks for your help,
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-11-09T13:25:16-07:00
by fmw42
syamashi wrote:Interestingly, I was not able to list the dimensions with one consolidated JPEG2000 file as opposed to what listed with Pyramidal TIFF file. However, I managed to print the dimensions of individually generated files and they appeared to be the same dimensions.
thanks for your help,
Perhaps IM does not support Pyramid structures in JP2000. It may be a limitation of the Jasper delegate library. Check the docs on Jasper and see if it does support it and report back.
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-11-15T14:36:03-07:00
by syamashi
Check the docs on Jasper and see if it does support it and report back.
Sorry, I couldn't find this.
Re: Converting Pyramidal TIFF to JPEG2000
Posted: 2012-11-15T15:59:41-07:00
by fmw42