DEV Community

hao jia profile picture

hao jia

404 bio not found

Joined Joined on 
Counting LZW codes to see why dithered GIFs come out bigger

Counting LZW codes to see why dithered GIFs come out bigger

Comments
4 min read
pdf.js render() resolves fine on a huge page, but the canvas reads back transparent

pdf.js render() resolves fine on a huge page, but the canvas reads back transparent

Comments
3 min read
Why getImageData returns different colors than putImageData wrote, at low alpha

Why getImageData returns different colors than putImageData wrote, at low alpha

Comments
4 min read
A bash loop that logs bytes and seconds for each PNG optimization step

A bash loop that logs bytes and seconds for each PNG optimization step

Comments
4 min read
Chromium turned my CFF OpenType font into Type 3 at every fsType value I tried

Chromium turned my CFF OpenType font into Type 3 at every fsType value I tried

Comments
3 min read
Alpha is just a plane in the pixel format, and FFmpeg drops it in three quiet places

Alpha is just a plane in the pixel format, and FFmpeg drops it in three quiet places

Comments
4 min read
Why 1-pass ABR landed under my target size: 60-second clip, x264, 25 and 10 MB

Why 1-pass ABR landed under my target size: 60-second clip, x264, 25 and 10 MB

Comments
3 min read
Estimating skew from OCR word boxes before row clustering: one of my three estimators broke at 5 degrees

Estimating skew from OCR word boxes before row clustering: one of my three estimators broke at 5 degrees

Comments
4 min read
Reading an image's matrix and clip from pdf.js getOperatorList: the last cm was enough until I nested one

Reading an image's matrix and clip from pdf.js getOperatorList: the last cm was enough until I nested one

Comments
4 min read
Where did the 254s go? A heatmap of non-255 pixels in a white JPEG

Where did the 254s go? A heatmap of non-255 pixels in a white JPEG

Comments
4 min read
Decode, draw, close, encode, save: one browser image loop, timed step by step

Decode, draw, close, encode, save: one browser image loop, timed step by step

Comments
4 min read
Computing a GIF's per-frame change box: one stray pixel keeps it at full canvas

Computing a GIF's per-frame change box: one stray pixel keeps it at full canvas

Comments
4 min read
How I put a number on the background-blur halo: luma difference in distance rings

How I put a number on the background-blur halo: luma difference in distance rings

Comments
4 min read
My WebCodecs encoder ladder for H.265: hardware hint first, a timed trial, H.264 as the floor

My WebCodecs encoder ladder for H.265: hardware hint first, a timed trial, H.264 as the floor

Comments
4 min read
I exported a long image at 300 DPI and got 175: the 16383-pixel ceiling

I exported a long image at 300 DPI and got 175: the 16383-pixel ceiling

Comments
3 min read
pdfsig said my edited signed PDF was still valid, so I compare ByteRange with the file size

pdfsig said my edited signed PDF was still valid, so I compare ByteRange with the file size

Comments
3 min read
Routing uploads to PNG-8 or WebP by content: the thumbnail, the fallback and the regression check

Routing uploads to PNG-8 or WebP by content: the thumbnail, the fallback and the regression check

Comments
5 min read
Multi-threaded AVIF encoding in the browser was 2-3x faster, until I raised the speed setting

Multi-threaded AVIF encoding in the browser was 2-3x faster, until I raised the speed setting

Comments
4 min read
FontFace loaded, check() said true, and my canvas still drew the fallback font

FontFace loaded, check() said true, and my canvas still drew the fallback font

Comments
4 min read
Dropping a VideoFrame is not closing it: 1,508 graphics buffers vs 12

Dropping a VideoFrame is not closing it: 1,508 graphics buffers vs 12

Comments
4 min read
Three ffmpeg one-liners that broke a portrait video, and the check that caught each one

Three ffmpeg one-liners that broke a portrait video, and the check that caught each one

Comments
4 min read
Mapping Word's srcRect crop to CSS and why center scaling drifts

Mapping Word's srcRect crop to CSS and why center scaling drifts

Comments
4 min read
The preview used my font, but the PDF's embedded font list didn't

The preview used my font, but the PDF's embedded font list didn't

Comments
5 min read
Measure ink and lighting before you binarize an image for OCR

Measure ink and lighting before you binarize an image for OCR

Comments 2
4 min read
256-colour PNGs can keep soft shadows. tRNS shows whether yours did

256-colour PNGs can keep soft shadows. tRNS shows whether yours did

1
Comments
5 min read
Detecting open passwords and permission locks in PDFs with pdf.js

Detecting open passwords and permission locks in PDFs with pdf.js

Comments
4 min read
A completed video seek did not always produce a new frame callback

A completed video seek did not always produce a new frame callback

Comments
3 min read
Testing MP4 delivery with identical media payloads and 200 or 206 responses

Testing MP4 delivery with identical media payloads and 200 or 206 responses

Comments
3 min read
Keep the original text when a PDF page falls back to OCR

Keep the original text when a PDF page falls back to OCR

Comments
4 min read
Reading a canvas back doubles its memory: numbers from three engines

Reading a canvas back doubles its memory: numbers from three engines

Comments
3 min read
My cutout PNG looked fine in canvas 2D and glowed in WebGL

My cutout PNG looked fine in canvas 2D and glowed in WebGL

Comments
3 min read
Decoding a progressive JPEG took 14 MiB more memory in my test

Decoding a progressive JPEG took 14 MiB more memory in my test

1
Comments
3 min read
Why red text blurs in canvas JPEG exports, and where 4:4:4 kicks in

Why red text blurs in canvas JPEG exports, and where 4:4:4 kicks in

Comments
5 min read
Compress-to-size in the browser: probe the quality floor before you bisect

Compress-to-size in the browser: probe the quality floor before you bisect

Comments
4 min read
onnxruntime-web numThreads silently falls back to 1 without COOP/COEP (6318 ms vs 2133 ms)

onnxruntime-web numThreads silently falls back to 1 without COOP/COEP (6318 ms vs 2133 ms)

1
Comments 1
3 min read
Ask the browser to decode HEIC before you ship a 510 KB WASM decoder

Ask the browser to decode HEIC before you ship a 510 KB WASM decoder

Comments 1
3 min read
canvas.toBlob ignores a string quality, and my first check for it was wrong

canvas.toBlob ignores a string quality, and my first check for it was wrong

Comments
3 min read
Your PDF export tool isn't the problem, your print CSS is

Your PDF export tool isn't the problem, your print CSS is

Comments
4 min read
I ship documents as one offline HTML file. Here is what I verify.

I ship documents as one offline HTML file. Here is what I verify.

Comments
5 min read
Measure the text, not the frame, when you compress a screen recording

Measure the text, not the frame, when you compress a screen recording

Comments
4 min read
The 4x upscale worked, and that was the problem: 30.7 MP, 41 MB, 38.7 s

The 4x upscale worked, and that was the problem: 30.7 MP, 41 MB, 38.7 s

Comments
4 min read
I replaced a docs-site GIF with animated WebP and it got bigger

I replaced a docs-site GIF with animated WebP and it got bigger

Comments
4 min read
A PDF is its own reference when you verify the images you pulled out of it

A PDF is its own reference when you verify the images you pulled out of it

Comments
4 min read
Our PDF upload limit says 2 MB. I tested auto-compression before adding it

Our PDF upload limit says 2 MB. I tested auto-compression before adding it

Comments
4 min read
Same 150 KB, three formats: what you actually get

Same 150 KB, three formats: what you actually get

Comments
4 min read
Your thumbnails look washed out: it's the ICC profile, not JPEG quality

Your thumbnails look washed out: it's the ICC profile, not JPEG quality

1
Comments 1
4 min read
Chrome fires onerror, WebKit shows it: feature-detect HEIC before you preview

Chrome fires onerror, WebKit shows it: feature-detect HEIC before you preview

Comments 1
4 min read
canPlayType said ‘probably’ in three engines; only two kept my transparent WebM transparent

canPlayType said ‘probably’ in three engines; only two kept my transparent WebM transparent

Comments
4 min read
Upright in the upload preview, sideways after the server saved it

Upright in the upload preview, sideways after the server saved it

Comments 3
5 min read
sort=True put both columns of a real arXiv paper on the same line

sort=True put both columns of a real arXiv paper on the same line

Comments 2
5 min read
Client-side or server-side image compression? How I decide per project

Client-side or server-side image compression? How I decide per project

Comments 2
3 min read
A 14-page report through HTML-to-PDF 4.8MB to 1.5MB

A 14-page report through HTML-to-PDF 4.8MB to 1.5MB

Comments
3 min read
Send a proposal without making them install Office or accept a PDF

Send a proposal without making them install Office or accept a PDF

Comments
2 min read
Fitting a video under a size cap without turning it to mush

Fitting a video under a size cap without turning it to mush

Comments
3 min read
OCR's hard part isn't reading characters, it's rebuilding the layout

OCR's hard part isn't reading characters, it's rebuilding the layout

Comments
2 min read
Is a 4x upscale twice as sharp as 2x? I measured what it actually adds

Is a 4x upscale twice as sharp as 2x? I measured what it actually adds

Comments
2 min read
Four places I check before shipping a cutout

Four places I check before shipping a cutout

Comments
3 min read
The images can't leave our network, so I picked the tool that doesn't send them

The images can't leave our network, so I picked the tool that doesn't send them

Comments
3 min read
DPI is an input, not a property of the file you get back

DPI is an input, not a property of the file you get back

1
Comments
3 min read
The WebP that was 92% smaller — because it only had one frame left

The WebP that was 92% smaller — because it only had one frame left

Comments
4 min read
loading...