惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
Engineering at Meta
Engineering at Meta
I
InfoQ
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 【当耐特】
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
腾讯CDC
雷峰网
雷峰网
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
D
Docker

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Converting HEIC to JPG entirely in the browser (no upload...
gan liu · 2026-06-27 · via DEV Community

gan liu

If you have ever received a photo from an iPhone and gotten a .heic file that Windows refuses to preview, you have met Apple's High Efficiency Image Container format. It saves space, but support outside the Apple ecosystem is still patchy in 2026.

Most online converters solve this by uploading your image to a server, converting it there, and sending it back. That works, but it means your personal photos travel to someone else's machine. For a format that is almost always personal photos, that bothered me. So I built a converter that never uploads anything.

The approach: decode HEIC client-side with WebAssembly

HEIC is essentially HEVC (H.265) intra-frames wrapped in a container. Browsers do not decode it natively, so the trick is to run a HEIC decoder compiled to WebAssembly directly in the page.

The high level flow:

  1. User drops a .heic file. You read it with the File API as an ArrayBuffer.
  2. A WASM build of libheif decodes the image into raw RGBA pixel data.
  3. You paint that data onto an offscreen canvas.
  4. canvas.toBlob() re-encodes it as JPEG, PNG or WebP at the quality you choose.
  5. You hand the user a download link via URL.createObjectURL().
const buffer = await file.arrayBuffer();
const image = await heifDecoder.decode(buffer); // libheif (wasm)
const canvas = document.createElement('canvas');
canvas.width = image.width;
canvas.height = image.height;
canvas.getContext('2d').putImageData(image.toImageData(), 0, 0);
canvas.toBlob((blob) => downloadBlob(blob, 'photo.jpg'), 'image/jpeg', 0.92);

Why client-side is worth the effort

  • Privacy: the file never leaves the device. No upload, no retention.
  • Speed: no round trip. Conversion starts the instant the file is read.
  • Cost: no servers to run, so the tool can stay free. It is just static files on a CDN.
  • Offline: once the page is cached, it works with no network at all.

The trade-off is bundle size (the WASM decoder is a few hundred KB) and that very large batches lean on the user's CPU. For typical phone photos it is instant.

The live tool

I packaged this into a free tool if you just want to convert something now: LivePhotoKit. It does HEIC to JPG/PNG/WebP/PDF, opens .livp Live Photo files, extracts the MP4, and batch converts, all in the browser with no sign-up.

If you want the non-developer walkthrough, I wrote it up here: How to open HEIC files on Windows 11.

Have you shipped anything with a WASM media decoder? I would love to compare notes on bundle size vs decode speed trade-offs.