DEV Community

Casey Marlin
Casey Marlin

Posted on

How to Batch Rewrite 100+ JPEGs and PNGs to 300 DPI in Your Browser (Zero Re-encoding, One ZIP)

Print shops, photographers delivering wedding galleries, and Etsy printable sellers run into the same repetitive workflow bottleneck every week: a folder of 60 to 150 high-resolution JPEGs or PNGs gets flagged by preflight software because every file is tagged 72 DPI or 96 DPI instead of 300 DPI.

Opening 80 images one by one in Photoshop just to uncheck Resample and type 300 is slow, and running them through naive "online DPI converter" scripts introduces two subtle bugs that break real print delivery.

Bug 1: Re-encoding JPEG Scan Data Ruins Quality

Many quick web tools "change DPI" by decoding the image onto a <canvas> element and exporting a fresh JPEG. Every time you re-save a lossy JPEG, quantization noise compounds, file sizes shift unpredictably, and PNG transparency or color metadata can quietly degrade.

Bug 2: Updating Only JFIF Leaves macOS Preview and Photoshop Reading "72 DPI"

A real-world JPEG can carry three independent density headers at the same time:

  1. JFIF APP0 block (often read by lightweight Python/PIL scripts)
  2. EXIF APP1 IFD0 tags (XResolution, YResolution, ResolutionUnit — read by macOS Finder/ImageIO and Windows properties)
  3. Photoshop 8BIM 0x03ED resource block (prioritized when a Photoshop-exported JPEG is reopened in Photoshop)

If a converter only patches JFIF and skips EXIF or Photoshop 8BIM, your client opens the delivered file on macOS or in Photoshop and still sees 72 DPI—triggering an avoidable dispute even though the file has plenty of pixels.

Rewriting All Density Metadata Losslessly in RAM

To fix a whole folder cleanly without uploading client galleries to an external server, you can use this client-side Bulk Image DPI Changer.

Here is what happens locally in browser memory:

  • JPEG files: JFIF, EXIF, and Photoshop 8BIM 0x03ED resolution fields are rewritten directly inside the binary segments while the actual SOS scan payload is copied byte-for-byte untouched.
  • PNG files: The pHYs chunk (pixels per metre, unit = 1) is updated or inserted before the first IDAT chunk with a recalculated CRC; IDAT pixel bytes and alpha transparency never touch a canvas.
  • No-recompress ZIP packaging: Up to 200 files per drop (staying within a sensible ~800 MB RAM ceiling) are written into setdpi-300dpi-batch.zip using ZIP STORE mode with UTF-8 filenames (photo_300dpi.jpg).

Quick Reality Check Before Batching

  • DPI is metadata, not an upscaler: Changing the density tag does not invent pixels (print inches = pixels ÷ DPI). A 600 × 600 px icon tagged 300 DPI still only prints cleanly at 2 × 2 inches. Always verify pixel dimensions first, then patch the tag.
  • Try small batches free: Single-file DPI edits on the site stay free forever. On the bulk page, your first 5 images in a batch download free with no signup; exporting larger client folders as one ZIP is unlocked with a one-time $3.99 Day Pass or $39.99 Lifetime license (no subscription).

Top comments (0)