jp2, ability to read regions

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
MarkusR
Posts: 3
Joined: 2018-01-29T14:28:49-07:00
Authentication code: 1152

jp2, ability to read regions

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

Re: jp2, ability to read regions

Post 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
MarkusR
Posts: 3
Joined: 2018-01-29T14:28:49-07:00
Authentication code: 1152

Re: jp2, ability to read regions

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: jp2, ability to read regions

Post 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.
snibgo's IM pages: im.snibgo.com
MarkusR
Posts: 3
Joined: 2018-01-29T14:28:49-07:00
Authentication code: 1152

Re: jp2, ability to read regions

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

Re: jp2, ability to read regions

Post by dlemstra »

image.Read("in.jp2[256x256+512+512]") can be used to read regions.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply