identify JPEG2000

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
wfa
Posts: 7
Joined: 2015-12-28T09:45:59-07:00
Authentication code: 1151

identify JPEG2000

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify JPEG2000

Post 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?
wfa
Posts: 7
Joined: 2015-12-28T09:45:59-07:00
Authentication code: 1151

Re: identify JPEG2000

Post 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!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: identify JPEG2000

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify JPEG2000

Post 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.
wfa
Posts: 7
Joined: 2015-12-28T09:45:59-07:00
Authentication code: 1151

Re: identify JPEG2000

Post 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
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: identify JPEG2000

Post by dlemstra »

.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: identify JPEG2000

Post 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".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify JPEG2000

Post 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.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: identify JPEG2000

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify JPEG2000

Post by fmw42 »

If urgent, a workaround would be to parse identify -verbose for the filesize.
wfa
Posts: 7
Joined: 2015-12-28T09:45:59-07:00
Authentication code: 1151

Re: identify JPEG2000

Post 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!
Post Reply