Cannot convert png to tiled jpeg2000

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Nesferjo
Posts: 2
Joined: 2019-06-16T01:59:51-07:00
Authentication code: 1152

Cannot convert png to tiled jpeg2000

Post by Nesferjo »

Hi! I'm pretty sure that this is a Bug. I have been trying to get the right output for a while and seems impossible. If I'm wrong, my apologies.

I'm using the latest version ImageMagick 7.0.8-49 Q16 x64 2019-06-08 over windows 10

I'm trying to convert a png image to a tiled JP2 image. The online documentation says that i have to write the tile size in brackets after the output file:

https://imagemagick.org/script/jp2.php

Save a tiled JPEG-2000 image:
convert wizard.png 'wizard.png[512x512]'


btw, I think that the documentation has a small typo as the extension of the out file should be jp2.

I've been trying to do this without any result. Executing this command:

Code: Select all

magick convert wizard.png wizard.jp2[512x512] 
creates a file of name 'wizard.jp2[512x512]' storing the image as jp2 with only just 1 tile (default value)

I tried many combinations, with and without quotation marks, tried to find JPEG-2000 decoding options, but I got no results.

Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cannot convert png to tiled jpeg2000

Post by fmw42 »

How do you know it was not tiled?

From the documentation:
Save a tiled JPEG-2000 image:

convert wizard.png 'wizard.png[512x512]'
That makes no sense to me. The bracket notation is typically for input cropping. But this may be something special for jp2.

Nevertheless, according to https://en.wikipedia.org/wiki/JPEG_2000, tiling is supported by the format. The question is how ImageMagick accesses it.


Also I agree the output should be jp2 not png.

But there seems to be no -define for tiling, only for multi-resolution on that documentation page at https://imagemagick.org/script/jp2.php

Furthermore, in ImageMagick 7, use magick, not magick convert or you will get IM 6 behavior.
Nesferjo
Posts: 2
Joined: 2019-06-16T01:59:51-07:00
Authentication code: 1152

Re: Cannot convert png to tiled jpeg2000

Post by Nesferjo »

'How do you know it was not tiled?'
a tiled jp2 has a bigger size and loads quite faster on small devices such as an iphone. Also, it is possible to extract a specific tile by using

Code: Select all

 magick convert wizard.jp2[tilePos] wizard.png
. With all the tests I made the file sizes were all the same. Also, trying to extract a tile other than the first resulted in an error.
Furthermore, in ImageMagick 7, use magick, not magick convert or you will get IM 6 behavior.
Really interesing. I used this and it seems to partially works:

Code: Select all

magick wizard.png wizard.jp2[512x512]
magick wizard.png wizard.jp2[128x128]
magick wizard.png wizard.jp2[64x64]
results in

Image

The files are actually stored with several tiles (file size changes and I can actually extract specific tiles), but the filenames are wrong, they got attached the tile options to the filename
Post Reply