Determine progressive JPEG by it’s content
From wiki-JPEG, we could see a baseline/progressive JPEG have byte marker mapping differently as following:
Short name | Bytes | Payload | Name |
---|---|---|---|
SOF0 | 0xFF, 0xC0 | variable size | Start Of Frame (baseline DCT) |
SOF2 | 0xFF, 0xC2 | variable size | Start Of Frame (progressive DCT) |
So to tell the image is progressive JPEG, we need to check if it contains 0xFF, 0xC0
which is c2ff
in Two-byte hexadecimal display
.
Check a local JPEG is progressive by hexdump
We could use hexdump
to display image contents in Two-byte hexadecimal display
format, then grep
to check if it contains c2ff
which is progressive only marker
1 | $ hexdump -x progressive.jpg | grep c2ff |
Check an image url is progressive curl, hexdump and grep
We could use curl
to fetch an image, then hexdump
to show it in Two-byte hexadecimal display
format, then grep
to check if it contains c2ff
, in short, curl <url> | hexdump -x | grep c2ff
1 | $ curl https://www.paddingleft.com/2018/09/04/check-a-JPEG-is-progressive-or-baseline/progressive.jpg | hexdump -x | grep c2ff |
Material
Here I got one progressive JPEG and one baseline JPEG for you to test :)