Detect Jpeg Minimum Coded Unit (MCU) size

Started by StarGeek, July 23, 2018, 07:29:13 PM

Previous topic - Next topic

StarGeek

I'm playing around with making a script that will using ImageMagick and JpegTran to do a lossless autocrop of solid color borders.  And while I could play it safe and assume that the block sizes are 16x16, I'd like it to be more accurate when possible.

So my question is, can the MCU size be determined from exiftool output?  Is the YCbCrSubSampling tag the data I should be looking at? 
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

StarGeek

Actually, it turns out the question is moot.  Jpegtran will move the top/left boundary outward to the nearest block edge, while holding the bottom/right edge in place.  I didn't expect that.

But now, I'm still interested in the answer to the above question. 

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

I have no idea.  I doubt that YCbCrSubSampling is what you need, but I don't ever remember seeing metadata for "Minimum Coded Unit".  "Micro Controller Unit" yes, but no other MCU that I remember.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

No worries.

It's not so much metadata as a property of the jpeg file, like EncodingProcess or BitsPerSample.  It's the size of blocks of pixels used in the encoding.

For all my searching around the web, it turns out I missed the line on Wikipedia where it says that 4:2:0 chroma subsampling is the 16x16 block size.  That gives me a starting point if I decide I want to test things further.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype