Page 1 of 1

jp2, ability to read regions

Posted: 2018-01-29T15:52:19-07:00
by MarkusR
Good day,

I have a very large jp2 file that I want to read sections of and create my own tiles. Is this possible?

-Markus

Re: jp2, ability to read regions

Posted: 2018-01-29T18:33:58-07:00
by fmw42
A bit more detail would be more helpful. But in the meantime, it would seem that you can do that with -crop in the command line. There should be a Magick.Net equivalent, but I do not use Magick.Net.

See https://www.imagemagick.org/Usage/crop/#crop

Re: jp2, ability to read regions

Posted: 2018-01-30T09:16:44-07:00
by MarkusR
Thanks for your comment.

I have a 200MB jp2 file (2.3GB png). I am needing to convert it to a deepzoom/tile format, 256x256 sized tiles. To do this I need to be able to read "chunks" of the file and save to jpg.

I will checkout crop in the meantime.

-Markus

Re: jp2, ability to read regions

Posted: 2018-01-30T10:27:13-07:00
by snibgo
The [] suffix seem to work with JP2, and this might prevent the entire image being read into memory, eg:

Code: Select all

convert in.jp2[256x256+512+512] out.png
So, in your code where you have the input filename, suffix it with "[256x256+512+512]" or whatever.

Re: jp2, ability to read regions

Posted: 2018-01-31T12:29:49-07:00
by MarkusR
Thanks Snibgo,

I will look for a Magick.Net equivalent.

For giggles I will run this this in a loop on the entire image to see how it takes.

-Markus

Re: jp2, ability to read regions

Posted: 2018-02-01T11:44:09-07:00
by dlemstra
image.Read("in.jp2[256x256+512+512]") can be used to read regions.