Menu

1 / 2

Padding a JPEG signature up to a 10 KB minimum without changing a pixel

DEV Community: frontend·Rai Ansar·about 15 hours ago
#bhBQdRFm
#devtofrontend#devto#dev#bytes#output
Reading 0:00
15s threshold

I build a browser tool that resizes photos and signatures for Indian exam and job application forms. Most of the work is the obvious kind: a form says "under 20 KB", so you shrink the file until it fits. The case that caught me out was the opposite one, where a signature comes out too small for the form to accept.

Several notices set the signature as a window. IBPS RRB XV (Officers and Office Assistants), RCF Assistant Officer (Secretarial) and India Exim Bank SRD 2026 all ask for 140 × 60 px and 10 to 20 KB. TNPSC One Time Registration asks for 230 × 75 px, also 10 to 20 KB. So there is a floor as well as a ceiling, and the pixel size is fixed.

Quality 100 is not enough

My first assumption was that a file under the minimum just needs a higher JPEG quality. That works until quality is already at 100.

A signature is dark ink on white paper. At 140 × 60 there are only 8,400 pixels, and most of the 8 × 8 blocks the encoder works on are flat white. Those compress to almost nothing.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.