Page 1 of 1
identify JPEG2000
Posted: 2016-01-12T08:44:18-07:00
by wfa
When I convert a tiff to a jp2 "identify" acts strange:
If Identify the jp2 without parameters, it returns the filesize correctly, but formatted, it returns a size of 0B.
Here is the case:
$ identify test.tif
test.tif TIFF 5518x3906 5518x3906+0+0 8-bit Grayscale Gray
21.58MB 0.000u 0:00.000
$ identify test.jp2
test.jp2 JP2 5518x3906 5518x3906+0+0 8-bit Grayscale Gray
1.169MB 0.000u 0:00.000
$ identify -format "'%d','%t','%e','%b', %h, %w, %Q\n" ./test.tif
'.','test','tif',
'21.58MB', 3906, 5518, 92
$ identify -format "'%d','%t','%e','%b', %h, %w, %Q\n" ./test.jp2
'.','test','jp2',
'0B', 3906, 5518, 92
Is there an explanation for this? And a workaround?
Here's my IM version:
$ identify -version
Version: ImageMagick 6.9.2-7 Q16 x86_64 2015-12-06
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License:
http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff webp wmf x xml zlib
Re: identify JPEG2000
Posted: 2016-01-12T10:11:49-07:00
by fmw42
Can you post your jp2 image to some place like dropbox.com and put the URL here so we can test with it?
Re: identify JPEG2000
Posted: 2016-01-12T10:48:54-07:00
by wfa
Here is the dropbox:
https://www.dropbox.com/sh/8dnac8w0wq8j ... qpYNa?dl=0
The behaviour occurs on any jp2 file.
In my procedure I would like to store information from "
Code: Select all
identify -format "'%d','%f','%e','%b', %h, %w, %Q $file
" in a database, but in every record it shows "0B"
If I run identify without options is shows the real size.
A workaround would be to first insert and after that update the record, but that's stupid.
Thanks in advance!
Re: identify JPEG2000
Posted: 2016-01-12T10:58:17-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.3-1 Beta, available by sometime tomorrow. Thanks.
Re: identify JPEG2000
Posted: 2016-01-12T11:03:05-07:00
by fmw42
I can confirm your results with your image and also with the following test on IM 6.9.3.0 Q16 Mac OSX Snow Leopard and
JP2* JP2 rw- JPEG-2000 File Format Syntax (2.1.0)
convert logo: JP2:logo.jp2
identify logo.jp2
logo.jp2 JP2 640x480 640x480+0+0 8-bit sRGB 106KB 0.000u 0:00.000
identify -format "%b" logo.jp2
0B
convert logo.jp2 -format "%b" info:
0B
Looks like a bug to me.
Re: identify JPEG2000
Posted: 2016-01-12T13:13:23-07:00
by wfa
Thanks guys!
Right now I use an IM rpm on Fedora. Can you point me the location of the patch when it's available?
Cheers,
Rene
Re: identify JPEG2000
Posted: 2016-01-12T14:01:43-07:00
by dlemstra
Re: identify JPEG2000
Posted: 2016-01-12T18:52:44-07:00
by GeeMack
I get the same "0B" result when testing on various JP2 image files using IM7 version "ImageMagick 7.0.0-0 Q16 x64 2016-01-02".
Re: identify JPEG2000
Posted: 2016-01-12T19:02:55-07:00
by fmw42
I believe that dlemstra just gave you the link to the patch that you would need to edit and recompile IM. If you got Imagemagick 7 from the Imagemagick web site betas, it probably does not yet have that patch compiled into it. dlemstra can correct me, if I am wrong.
Re: identify JPEG2000
Posted: 2016-01-12T19:15:51-07:00
by GeeMack
fmw42 wrote:I believe that dlemstra just gave you the link to the patch that you would need to edit and recompile IM. If you got Imagemagick 7 from the Imagemagick web site betas, it probably does not yet have that patch compiled into it. dlemstra can correct me, if I am wrong.
I always download pre-compiled versions, so I won't be applying patches. This particular issue doesn't affect my workflow directly, but I thought I'd test it and mention that it also applies to the beta IM7 package. Since the developers are aware of it, I'm sure they'll be doing what's necessary to remedy the issue. And as always, thanks for all the time and effort!
Re: identify JPEG2000
Posted: 2016-01-12T20:42:39-07:00
by fmw42
If urgent, a workaround would be to parse identify -verbose for the filesize.
Re: identify JPEG2000
Posted: 2016-01-13T00:37:24-07:00
by wfa
For the filesize you can just run identify without parameters and use awk for the size, e.a:
Code: Select all
identify <file> | awk '{print $8}'
In my case it returns 1.169MB
To store it in a variable, use:
Code: Select all
fsize=$(identify test.jp2 | awk '{print $8}')
In case of my procedure, I need the parameters. I will test it asap.
Thanks!