Koldflux test log: reduce-image-to-kb-limit, 2026-11-24
Inputs (sha1):
in/landscape.jpg 2915869 bytes 60eab74e7704
in/newspaper.jpg 1010293 bytes 98a90ef1f53e
in/portrait.jpg 1208505 bytes 3ad5114c1769
in/screenshot.png 221015 bytes 3442e8c79ea6
Tool: https://koldflux.com/tools/image/target-size, headless Chromium (Playwright), JPEG output, 1 KB = 1,024 bytes. Bytes below are measured on the downloaded files with wc -c.
== A. Tool outputs (tool-measure.tsv). shrink = box ticked (quality first, then smaller picture); quality = box unticked (quality only, search down to 5%, picture size unchanged)
file kb_target bytes width height ssim fits_1024 fits_1000
landscape-quality-100 100 143920 5184 3456 0.880704 no no
landscape-quality-20 20 143920 5184 3456 0.880704 no no
landscape-quality-200 200 190441 5184 3456 0.904694 yes yes
landscape-quality-50 50 143920 5184 3456 0.880704 no no
landscape-shrink-100 100 101046 1260 840 0.968434 yes no
landscape-shrink-20 20 20106 529 352 0.961306 yes no
landscape-shrink-200 200 200135 1952 1301 0.969318 yes no
landscape-shrink-50 50 51015 875 583 0.966728 yes no
newspaper-quality-100 100 127971 2120 3200 0.772391 no no
newspaper-quality-20 20 127971 2120 3200 0.772391 no no
newspaper-quality-200 200 185121 2120 3200 0.816136 yes yes
newspaper-quality-50 50 127971 2120 3200 0.772391 no no
newspaper-shrink-100 100 97312 515 778 0.911042 yes yes
newspaper-shrink-20 20 20009 248 374 0.902306 yes no
newspaper-shrink-200 200 202840 735 1110 0.936284 yes no
newspaper-shrink-50 50 50970 358 540 0.921242 yes no
portrait-quality-100 100 94028 3175 3920 0.974356 yes yes
portrait-quality-20 20 82043 3175 3920 0.963691 no no
portrait-quality-200 200 197125 3175 3920 0.989582 yes yes
portrait-quality-50 50 82043 3175 3920 0.963691 no no
portrait-shrink-100 100 100517 1667 2058 0.992968 yes no
portrait-shrink-20 20 19278 536 662 0.992228 yes yes
portrait-shrink-200 200 197125 3175 3920 0.989582 yes yes
portrait-shrink-50 50 51067 1007 1243 0.993732 yes no
portrait-shrink-custom97 97 97975 1667 2058 0.992939 yes no
screenshot-quality-100 100 99809 1440 2200 0.957575 yes yes
screenshot-quality-20 20 47849 1440 2200 0.931842 no no
screenshot-quality-200 200 185075 1440 2200 0.976239 yes yes
screenshot-quality-50 50 47849 1440 2200 0.931842 yes yes
screenshot-shrink-100 100 100663 842 1286 0.973421 yes no
screenshot-shrink-20 20 19467 329 502 0.975087 yes yes
screenshot-shrink-200 200 185075 1440 2200 0.976239 yes yes
screenshot-shrink-50 50 51108 542 828 0.977380 yes no
== B. Counts (computed)
tool quality-only: missed 9 of 16
tool shrink: fits 1024-limit 16 of 16; fits decimal limit (target KB x 1000) 5 of 16
== C. ffmpeg route, limit = KB x 1024 (to-kb.sh, ff-bin)
file kb_target bytes width height ssim fits_1024 fits_1000
landscape-100 100 95305 1554 1036 0.968113 yes yes
landscape-20 20 18113 518 346 0.969247 yes yes
landscape-200 200 200374 2592 1728 0.967281 yes no
landscape-50 50 47661 1036 690 0.965758 yes yes
newspaper-100 100 97748 636 960 0.916386 yes yes
newspaper-20 20 19103 212 320 0.963369 yes yes
newspaper-200 200 191839 1060 1600 0.905752 yes yes
newspaper-50 50 43489 424 640 0.915660 yes yes
portrait-100 100 96351 1904 2350 0.991949 yes yes
portrait-20 20 19413 634 782 0.991915 yes yes
portrait-200 200 196719 2856 3526 0.991589 yes yes
portrait-50 50 48944 1270 1568 0.992389 yes yes
screenshot-100 100 100944 1008 1540 0.965372 yes no
screenshot-20 20 18739 288 440 0.986266 yes yes
screenshot-200 200 197556 1440 2200 0.975607 yes yes
screenshot-50 50 46558 576 880 0.967129 yes yes
== D. ffmpeg route, limit = KB x 1000 (ff-dec)
file kb_target bytes width height ssim fits_1024 fits_1000
landscape-100 100 95305 1554 1036 0.968113 yes yes
landscape-20 20 18113 518 346 0.969247 yes yes
landscape-200 200 180234 2592 1728 0.963670 yes yes
landscape-50 50 47661 1036 690 0.965758 yes yes
newspaper-100 100 97748 636 960 0.916386 yes yes
newspaper-20 20 19103 212 320 0.963369 yes yes
newspaper-200 200 191839 1060 1600 0.905752 yes yes
newspaper-50 50 43489 424 640 0.915660 yes yes
portrait-100 100 96351 1904 2350 0.991949 yes yes
portrait-20 20 19413 634 782 0.991915 yes yes
portrait-200 200 196719 2856 3526 0.991589 yes yes
portrait-50 50 48944 1270 1568 0.992389 yes yes
screenshot-100 100 88202 864 1320 0.966219 yes yes
screenshot-20 20 18739 288 440 0.986266 yes yes
screenshot-200 200 197556 1440 2200 0.975607 yes yes
screenshot-50 50 46558 576 880 0.967129 yes yes
== E. ffmpeg -q:v 31 at full size (worst quality, no resize)
file kb_target bytes width height ssim fits_1024 fits_1000
landscape-31 31 451007 5184 3456 0.955696 no no
newspaper-31 31 236877 2120 3200 0.848048 no no
portrait-31 31 216078 3175 3920 0.988099 no no
screenshot-31 31 108291 1440 2200 0.947679 no no
== F. Edge cases and published commands
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
== G. Controls
SSIM of a file against itself (portrait): All:1.000000
raw run logs: tool-run-raw.txt, ff-run-raw.txt (not published)
== H. Definitions used on the page
Decimal reading of 100 KB = 100,000 bytes (SI kilo); the tool reads 1 KB as 1,024 bytes (its panel: 100 KB = 102,400 bytes). 100,000 is a definition, not a measured value.
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