identify JPEG2000
identify JPEG2000
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
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
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: identify JPEG2000
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
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 "" 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!
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
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
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.3-1 Beta, available by sometime tomorrow. Thanks.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: identify JPEG2000
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.
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
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
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
You can find onze patch here: http://git.imagemagick.org/repos/ImageM ... 140ed2fe89
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: identify JPEG2000
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".
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: identify JPEG2000
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.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: identify JPEG2000
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!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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: identify JPEG2000
If urgent, a workaround would be to parse identify -verbose for the filesize.
Re: identify JPEG2000
For the filesize you can just run identify without parameters and use awk for the size, e.a: In my case it returns 1.169MB
To store it in a variable, use:
In case of my procedure, I need the parameters. I will test it asap.
Thanks!
Code: Select all
identify <file> | awk '{print $8}'
To store it in a variable, use:
Code: Select all
fsize=$(identify test.jp2 | awk '{print $8}')
Thanks!