Latest in Images
Working with images in Node.js — conversion, resizing, format trade-offs, and generating or manipulating graphics programmatically.
How to save a web page as PNG or PDF with Puppeteer?
Turn any web page into a PDF or a full-page PNG screenshot with Puppeteer and headless Chrome — natively, in just a few lines, with none of the Xvfb, DPI, or screenshot-stitching workarounds the old Nightmare approach required.
Batch convert a folder of images to WebP and AVIF with Node.js (sharp) or FFmpeg
A ~70-line Node.js script that converts every JPG and PNG in a folder tree to WebP and AVIF with sharp — with resizing, EXIF auto-rotation, skip-if-up-to-date and parallelism, and no glob package thanks to the built-in fs.glob. Plus SVG to PNG, the FFmpeg one-liners, and the transparency gotcha that FFmpeg won't warn you about. Verified on node:24-slim and node:26-slim.
Serve AVIF or WebP automatically from Node.js based on the Accept header (and why you need Vary: Accept)
An Express middleware that serves photo.avif or photo.webp when a browser asks for photo.jpg and accepts the newer format, with no HTML changes. Testing the original version of this middleware found four bugs, including the dangerous one: without Vary: Accept, a cache in front of the server hands AVIF to clients that can't display it. Verified with curl, an nginx cache, and Chromium, Firefox and WebKit.
Read and strip image EXIF data with JavaScript: camera, date and GPS in the browser and Node.js
Photos carry EXIF metadata: the camera, the time, and often the exact GPS location. Read it in the browser or in Node.js with ExifReader, then remove it before you publish an upload, without turning portrait photos sideways. Tested with a real GPS-tagged JPEG in Chromium, Firefox and WebKit and on Node 24 and 26.
Build a placeholder image service (placehold.it clone) with Node.js, Express 5 and sharp
A small Express 5 + sharp server that returns placeholder images such as /600x400.webp?bg=0891b2&text=Hello in PNG, WebP, AVIF, JPEG or SVG, in about 11 ms each. It also fixes the problems in the classic version: the Express 5 route error, SVG injection through the text, unbounded image sizes, and the empty boxes you get for text in a slim Docker image.