Skip to content

Decompile JPEG into text showing elementary block data; encode back into JPEG. Used to fix corruption artifacts in images

License

Notifications You must be signed in to change notification settings

albmac/jpeg-decomp

Repository files navigation

jpeg-decomp

A command-line utility able to decompile JPEG images into text form, i.e. separate various sections and decompose the data stream in elementary blocks (MCU and Y,Cb,Cr).
Once in text form, the image can be edited by adding, removing, or modifying MCUs or component blocks, with the purpose of fixing errors due to data corruption.
Finally, a new image can be generated from text form.

This tool is superseded by JPEGVisualRepairTool

Fixing images


Read about Fixing JPEG images in the dedicated tutorial

Usage

option description
-fin <filename> Input file
-fout <filename> Output file
-decode Decode JPEG image into text format
-encode Encode text format into JPEG image

Text file format:

Tag Description
// or # Comment; lasts up to the end of the line. Useful information is produced by the -decode command, such as MCU coordinates and the decimal value of DC and AC coefficients, along with error warnings.
<raw>...</raw> Raw data in hex form; each line starts with 0x. This is non-interpreted data such as headers. It is written directly in the output file when using -encode
<dht>…<dht> Define Huffman table. First parameter is the table type: YDC, YAC, CDC, CAC; following is a list of elements in brackets [], each holding 3 hex values. Only non-standard Huffman tables are generated by -decode.
<y>...</y> Luminance block. The first number is the DC level expressed as decimal number; following is a bit string starting with 0b that represents AC coefficients. Missing DC or AC coefficients are replaced with the code representing 0. It uses YDC and YAC Huffman tables.
<c>...</c> Chrominance block. The first number is the DC level expressed as decimal number; following is a bit string starting with 0b that represents AC coefficients. Missing DC or AC coefficients are replaced with the code representing 0. It uses CDC and CAC Huffman tables.
<restart>N</restart> Restart marker. N is between 0 and 7.
<eoi></eoi> End of Image marker: not necessary as -encode inserts it anyways.

Compiling

Sources are in plain C. Build using make:
>make

Download

Already compiled for Windows

About

Decompile JPEG into text showing elementary block data; encode back into JPEG. Used to fix corruption artifacts in images

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published