test-only (named on the page, not in its code block): ffmpeg -i photo.jpg -q:v 31 out.jpg
command as run: ffmpeg -v error -y -i in/portrait.jpg -q:v 31 -frames:v 1 -update 1 edge/q31.jpg; wc -c < edge/q31.jpg
exit=0
edge: worst ffmpeg quality at full size; 216,078 bytes, still over 100 KB | 216078
published: bash to-kb.sh photo.jpg 102400 out.jpg
command as run: bash to-kb.sh in/portrait.jpg 102400 edge/out.jpg
exit=0
edge: main case, portrait 3175 x 3920 | to-kb: ok: 96351 bytes (limit 102400), width 1904 px (60% of 3175), ffmpeg -q:v 8 -> edge/out.jpg
published: wc -c < out.jpg
command as run: wc -c < edge/out.jpg
exit=0
edge: byte count of the result | 96351
published: ffprobe -v error -show_entries stream=width,height -of csv=p=0 out.jpg
command as run: ffprobe -v error -show_entries stream=width,height -of csv=p=0 edge/out.jpg
exit=0
edge: pixel size of the result | 1904,2350
test-only (not on the page): ffmpeg -i out.jpg -i photo.jpg -lavfi scale + ssim
command as run: ffmpeg -i edge/out.jpg -i in/portrait.jpg -lavfi "[0:v]scale=3175:3920:flags=lanczos[a];[a][1:v]ssim" -f null - 2>&1 | grep -o "All:[0-9.]*"
exit=0
edge: similarity of result to original at original size | All:0.990708
test-only (not on the page): ffmpeg -i photo.jpg -i photo.jpg -lavfi ssim (control)
command as run: ffmpeg -i in/portrait.jpg -i in/portrait.jpg -lavfi ssim -f null - 2>&1 | grep -o "All:[0-9.]*"
exit=0
edge: control: a file against itself must read 1.0 | All:1.000000
published: bash to-kb.sh missing.jpg 102400 o1.jpg
command as run: bash to-kb.sh missing.jpg 102400 o1.jpg
exit=1
edge: missing file | to-kb: file not found: missing.jpg
published: bash to-kb.sh empty.jpg 102400 o2.jpg
command as run: bash to-kb.sh empty.jpg 102400 o2.jpg
exit=1
edge: empty file | to-kb: file is empty: empty.jpg
published: bash to-kb.sh text-crlf.jpg 102400 o3.jpg
command as run: bash to-kb.sh text-crlf.jpg 102400 o3.jpg
exit=1
edge: text with Windows line breaks, not a picture (input made with: printf 'hello\r\nworld\r\n' > text-crlf.jpg; re-run 2026-11-24 after the verifier) | to-kb: ffprobe could not read a picture from: text-crlf.jpg
published: bash to-kb.sh фото-ü.jpg 102400 o4.jpg
command as run: bash to-kb.sh фото-ü.jpg 102400 o4.jpg
exit=0
edge: non-ASCII file name | to-kb: ok: 96351 bytes (limit 102400), width 1904 px (60% of 3175), ffmpeg -q:v 8 -> o4.jpg
published: bash to-kb.sh small.jpg 102400 o5.jpg
command as run: bash to-kb.sh small.jpg 102400 o5.jpg
exit=0
edge: picture already under the limit; input made with: ffmpeg -v error -y -i in/portrait.jpg -vf scale=200:-2 -q:v 5 small.jpg (4,501 bytes); the output is larger than the input (re-run 2026-11-24 after the verifier) | to-kb: ok: 5119 bytes (limit 102400), width 200 px (100% of 200), ffmpeg -q:v 2 -> o5.jpg
published: bash to-kb.sh ../in/landscape.jpg 300 o6.jpg
command as run: bash to-kb.sh ../in/landscape.jpg 300 o6.jpg
exit=3
edge: limit that cannot be reached | to-kb: could not reach 300 bytes with -q:v 12 or better and a width of at least 16 px
published: bash to-kb.sh ../in/landscape.jpg abc o7.jpg
command as run: bash to-kb.sh ../in/landscape.jpg abc o7.jpg
exit=2
edge: limit is not a number | to-kb: the limit must be a whole number of bytes, for example 102400
published: bash to-kb.sh ../in/landscape.jpg o8.jpg
command as run: bash to-kb.sh ../in/landscape.jpg o8.jpg
exit=2
edge: limit is empty | to-kb: usage: bash to-kb.sh
published: bash to-kb.sh transp.png 102400 o9.jpg
command as run: bash to-kb.sh transp.png 102400 o9.jpg
exit=0
edge: transparent PNG (input: ffmpeg -f lavfi -i color=c=red@0.0:s=64x64,format=rgba -frames:v 1 transp.png; the result scaled to 1x1 px reads fe0000, so the alpha channel is dropped and the stored red shows) | to-kb: ok: 272 bytes (limit 102400), width 64 px (100% of 64), ffmpeg -q:v 2 -> o9.jpg
to-kb: usage: bash to-kb.sh
exit=2 no arguments
published: bash to-kb.sh tiny.png 102400 o10.jpg
command as run: bash to-kb.sh tiny.png 102400 o10.jpg
exit=3
edge: 10 x 10 px PNG (96 bytes), narrower than 16 px | to-kb: could not reach 102400 bytes with -q:v 12 or better and a width of at least 16 px
published: bash to-kb.sh odd.png 1000000 o11.jpg
command as run: bash to-kb.sh odd.png 1000000 o11.jpg
exit=0
edge: odd width, 1001 x 777 px input (ffmpeg -f lavfi -i testsrc=s=1001x777); the output is 1000 x 776 px | to-kb: ok: 67136 bytes (limit 1000000), width 1000 px (100% of 1001), ffmpeg -q:v 2 -> o11.jpg