grk_decompress(1)
π NAME π
okay bestie, welcome to grk_decompress β it's the tool that takes your JPEG 2000 image and turns it into a whole different image format. decompress, convert, serve π
πΈ SYNOPSIS πΈ
grk_dcompress [-i infile.j2k] [-o outfile.bmp]
β¨ DESCRIPTION β¨
So like β this program decompresses a JPEG 2000 image and stores it in another image format. that's the whole vibe. no cap.
Supported input formats: JP2 and J2K\J2C. Supported input image extensions are .jp2 and .j2k\.j2c.
Supported output formats are JPEG, BMP, PNM, PGX, PNG, RAW and TIFF.
Valid output image extensions are jpg, .jpeg, .bmp, .pgm, .pgx, .pnm, .ppm, .pam, .png, .raw, .rawl, .tif and .tiff.
- For PNG the library must have
libpngavailable. π - For TIF\TIFF the library must have
libtiffavailable. π - For JPG\JPEG the library must have a
libjpegvariant available. π
π Limitations π
- Grok supports up to and including 16 bit sample precision for decompression. This is a subset of the ISO standard, which allows up to 38 bit precision. so yeah, we're not doing the whole 38-bit thing, that's just how it is bestie.
π¨οΈ stdout π¨οΈ
The decompresser can write output to stdout for the following formats: BMP, PNG, JPG, PNM, RAW and RAWL. To enable writing to stdout, please make sure that the -o parameter is not present in the command line, and that the -out_fmt parameter is set to one of the supported formats listed above.
Note: the verbose flag -v will be ignored in this mode, because verbose output would corrupt the output file. π she's quiet for a reason.
π Embedded ICC Profile π
If there's an embedded ICC profile in the input file, then the profile will be stored in the output file for TIF\TIFF, JPG, BMP and PNG formats. For other formats, the profile will be applied to the decompressed image before it is stored.
π IPTC (JP2 only) π
If a compressed input contains IPTC metadata, this metadata will be stored to the output file if that output file is in TIF\TIFF format.
π¦ XMP (JP2 only) π¦
If a compressed input contains XMP metadata, this metadata will be stored to the output file if that output file is in TIF\TIFF or PNG format.
π Exif (JP2 only) π
To transfer Exif and all other meta-data tags, use the command line argument -V described below. To transfer the tags, Grok uses the ExifTool (<https://exiftool.org/>) Perl module. ExifTool must be installed for this command line argument to work properly.
Note: transferring Exif tags may add a few hundred ms to the decompress time, depending on the system. just a lil wait, she's doing her makeup π
Important note on command line argument notation below: the outer square braces appear for clarity only, and should not be included in the actual command line argument. Square braces appearing inside the outer braces should be included.
π Options π
-h,-helpβ print a help message and exit. the "what do I even do" button π«Ά-versionβ print library version and exit. identity check β¨-v,-verboseβ output information and warnings about decoding to console (errors are always output). Console is silent by default. she's shy until you ask π€«-i,-in_file[file] β input file. Either this argument or the-img_dirargument described below is required. Valid input image extensions areJ2K,JP2andJPC. When using this option, output file must be specified using-o.-o,-out_file[file] β output file. Required when using-ioption. See above for supported file types. If a PGX filename is given, there will be as many output files as there are components: an index starting from0will then be appended to the output filename, just before thepgxextension. If a PGM filename is given and there is more than one component, then only the first component will be written to the file. (she's splitting up the friend group, sorry π)-y,-img_dir[directory path] β path to the folder where the compressed images are stored. Either this argument or the-iargument described above is required. When image files are in the same directory as the executable, this can be indicated by a dot.argument. When using this option, the output format must be specified using-out_fmt. Output images are saved in the same folder.-a,-out_dir[output directory] β output directory where compressed files are stored. Only relevant when the-img_dirflag is set. Default: same directory as specified by-img_dir.-O,-out_fmt[format] β output format used to decompress the code streams. Required when-img_diroption is used. See above for supported formats.-r,-reduce[reduce factor] β reduce factor. Set the number of highest resolution levels to be discarded. The image resolution is effectively divided by2to the power of the number of discarded levels. The reduce factor is limited by the smallest total number of decomposition levels among tiles.-l,-layer[layer number] β layer number. Set the maximum number of quality layers to decode. If there are fewer quality layers than the specified number, all quality layers will be decoded.-d,-region[x0,y0,x1,y1] β decompress a region of the image. If(X,Y)is a location in the image, then it will only be decoded ifx0 <= X < x1andy0 <= Y < y1. By default, the entire image is decoded.
There are two ways of specifying the decompress region:
- pixel coordinates relative to image origin β region is specified in 32 bit integers.
Example: if image coordinates on canvas are (50,50,1050,1050) and region is specified as -d 100,100,200,200, then a region with canvas coordinates (150,150,250,250) is decompressed
- pixel coordinates relative to image origin and scaled as floating point to unit square
[0,0,1,1]
The above example would be specified as -d 0.1,0.1,0.2,0.2
Note: there is one ambiguous case, namely -d 0,0,1,1, which could be interpreted as either scaled or un-scaled. We treat this case as a scaled pixel region. π
-m,-random_access[random access flags] β toggle support for random access code stream markers if present:PLT,TLMorPLM;
The random access flags value passed in is an or'd combination of the following flags:
1 use PLT marker if present
2 use TLM marker if present
4 use PLM marker if present
example: -m 0 would disable all three markers.
-c,-compression[compression value] β compress output image data. Currently, this flag is only applicable when output format is set toTIF. Possible values are{NONE, LZW,JPEG, PACKBITS. ZIP,LZMA,ZSTD,WEBP}. Default value isNONE.-L,-compression_level[compression level] β "quality" of compression. Currently only implemented for PNG format. For PNG, compression level ranges from0(no compression) up to9. Grok default value is3.
Note: PNG is always lossless, so using a different level will not affect the image quality. It only changes the speed vs file size tradeoff. slay, no quality loss π
-t,-tile_index[tile index] β only decode tile with specified index. Index follows the JPEG2000 convention from top-left to bottom-right. By default all tiles are decoded.-p,-precision[component 0 precision[C|S],component 1 precision[C|S],...] β force precision (bit depth) of components. There must be at least one value present, but there is no limit on the number of values. The last values are ignored if too many values. If there are fewer values than components, the last value is used for the remaining components. IfCis specified (default), values are clipped. IfSis specified, values are scaled. Specifying a0value indicates use of the original bit depth.
Example:
-p 8C,8C,8c
Clip all components of a 16 bit RGB image to 8 bits.
-f,-force_rgbβ force output image color space to RGB. ForTIF/TIFForPNGoutput formats, the ICC profile will be applied in this case β default behaviour is to stored the profile in the output file, if supported.-u,-upsampleβ sub-sampled components will be upsampled to image size.-s,-split_pnmβ split output components into different files when writing to PNM.-X,-xml[output file name] β store XML metadata to file, if it exists in compressed file. File name will be set to output file name +".xml"-V,-transfer_exif_tagsβ transfer all Exif tags to output file.
Note: ExifTool (<https://exiftool.org/>) must be installed for this command line argument to work correctly.
-W,-logfile[output file name] β log to file. File name will be set to output file name.-H,-num_threads[number of threads] β number of threads used for T1 compression. Default is total number of logical cores. she's multithreaded and unbothered β¨-e,-repetitions[number of repetitions] β number of repetitions, for either a single image, or a folder of images. Default is1.0signifies unlimited repetitions. (why would you do this? iconic behaviour, that's why π₯)
π§ FILES π§
(yeah bestie, this section is just vibing here empty. no files listed. it's giving minimalist π)
π ENVIRONMENT π
(nothing here either β no environment variables to worry about, you're free π¦)
π BUGS π
See GitHub Issues: <https://github.com/GrokImageCompression/grok/issues>
π AUTHOR π
Grok Image Compression Inc.
π₯ SEE ALSO π₯
and that's the whole page, bestie β written up by the Grok Image Compression Inc. girlies, Version 10.0, and yeah, the footer says grk_decompress(1) one more time because she's that girl. go decompress something cute π«Άπβ¨
π¦ where this page comes from
- debian bookworm: grokj2k-tools 10.0.5-1 Β· AGPL-3.0-only AND BSD-2-Clause AND Apache-2
- ubuntu noble: grokj2k-tools 10.0.5-1build4 Β· AGPL-3.0-only AND BSD-2-Clause AND Apache-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms