ImageMagick – JP2 Encoding Options
Description: ImageMagick is a powerful, open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for web developers, graphic designers, and researchers, it offers versatile tools for image processing, including batch processing, format conversion, and complex image transformations.
Keywords: JP2 Encoding Options, Image Processing, Digital Image Editing, Image Conversion, Open-Source Software, Image Manipulation, Command-Line Image Tools

ImageMagick's JPEG-2000 image formats, JP2 and JPC, accept a plethora of encoding options as detailed below. As an example, suppose you are interested in these options:

- code blocks are 64 samples in width and 32 samples in height
- no multicomponent transform
- 4 resolution levels for each component
- compression is lossy at 64:1

Use this command to convert a JPEG-2000 image to the PNG image format:

    magick wizard.jp2 wizard.png

Let's convert a JPEG image to a lossless JPEG-2000 image:

    magick wizard.jpg -quality 0 wizard.jp2

Here we extract an area from the image:

    magick 'wizard.jp2[640x480+0+0]' wizard.png

Extract a particular tile from the image:

    magick 'wizard.jp2[2]' wizard.png

Specify a subsampling factor:

    magick wizard.png -colorspace YUV -sampling-factor 2:2 wizard.jp2

Save a tiled JPEG-2000 image:

    magick wizard.png 'wizard.png[512x512]'

Write a digital Cinema 4K profile compliant codestream:

    magick wizard.png -resize 4096x2160! -depth 12 wizard.jp2

Here is a complete list of JPEG-2000 decoding options:

jp2:quality-layers=x | set the maximum number of quality layers to decode.
jp2:reduce-factor=x | set the number of highest resolution levels to be discarded.

Here is a complete list of JPEG-2000 encoding options:

jp2:number-resolutions=x | number of resolutions to encode.
jp2:quality=x,x,... | set the quality layer PSNR, given in dB. The order is from left to right in ascending order. The default is a single lossless quality layer.
jp2:rate=x,x,... | the compression ratio values. Each value is a factor of compression, thus 20 means 20 times compressed. The order is from left to right in descending order. A final lossless quality layer is signified by the value 1. The default is a single lossless quality layer.
jp2:progression-order=x | choose from LRCP, RLCP, RPCL, PCRL or CPRL.