Image Compressor
Shrink photos for the web and email while watching the exact before/after file size — quality slider plus an optional max-width, all in your browser.
为网页与邮件压缩照片,实时查看压缩前后的精确体积——质量滑杆加可选最大宽度,全在浏览器完成。
Private by design — your photo is processed locally and never uploaded.Drop a photo here, or click to browse
Supported formats: JPG, PNG, WebP, GIF, BMP
Drag to compare
Tip: PNG output stays lossless (the quality slider won't shrink it); choose JPG or WebP to actually reduce size.
提示:PNG 输出无损(质量滑杆无法压缩它);要真正减小体积请选 JPG 或 WebP。
How It Works
The Image Compressor draws your photo onto a canvas, optionally scales it down to a max width, then re-encodes it as JPG or WebP at the quality you choose. It measures the result from the encoded data and shows the real file size and the percentage you saved — all on your device.
Quality slider
Lower quality = smaller file. Around 75–85 keeps photos looking crisp on the web while cutting size dramatically.
Max width
Set a long-edge cap (e.g. 1600px) to shrink oversized scans. 0 keeps the original dimensions.
Honest size readout
You see the original bytes, the compressed bytes and the savings percent before you download.
Fully local
Compression runs in your browser with the Canvas API. Photos are never uploaded or stored.
An honest note: compression is lossy (except PNG). Pushing quality very low or shrinking a small image too far will introduce visible blockiness or softness. Keep the quality at 70–85 for most web use, and always keep an uncompressed master copy of your original.
Image Compressor 把照片绘到画布上,可选地缩放到指定最大宽度,再按你选的质量重新编码为 JPG 或 WebP。它根据编码后的数据测量结果,显示真实文件体积与节省百分比——全程在你的设备上完成。
质量滑杆
质量越低体积越小。约 75–85 在网页上依然清晰,同时大幅减小体积。
最大宽度
给长边设上限(如 1600 像素)缩小过大扫描件;填 0 保持原尺寸。
诚实的体积读数
下载前就能看到原始体积、压缩后体积与节省百分比。
完全本地
压缩在浏览器中通过 Canvas API 完成,照片绝不上传或存储。
诚实说明:压缩是有损的(PNG 除外)。质量压得过低,或把小图缩得太小,会出现明显色块或发虚。一般网页用途保持质量 70–85,并务必保留一份未压缩的原始母版。
How to Use
- Upload the photoDrop it in or click to browse. The tool reads its exact original file size.
- Lower the qualityDrag the slider toward 75–85 and watch the compressed size drop. Add a max width for very large scans.
- Check the savingsRead the original vs compressed size and the savings percentage; drag to compare visual quality.
- DownloadSave the smaller JPG or WebP. Keep your original master untouched.
- 上传照片拖入或点击选择,工具会读取它精确的原始文件体积。
- 调低质量把滑杆拖到 75–85,观察压缩后体积下降;超大扫描件再加最大宽度。
- 查看节省对比原始与压缩体积及节省百分比,用滑块检查画质。
- 下载保存更小的 JPG 或 WebP,原始母版保持不动。
Who this is for — and what it will not do
For getting under a size limit without visibly damaging the photo: email attachments, upload forms, website images and messaging apps. The useful question is not "smallest possible" but "small enough for this portal while still looking like the original".
- Email attachment limits. Shrinking a 12 MB scan to something that will actually send.
- Upload portals with caps. Visa, insurance and job forms that reject files over a fixed size.
- Faster web pages. Images are usually the heaviest asset; a modest quality drop is invisible at display size.
Mistakes that ruin the result, and the fix for each
- Compressing before retouching. JPEG artefacts get baked in and are then amplified by contrast and sharpening. Repair first, compress last.
- Recompressing the same JPEG repeatedly. Each save adds new artefacts. Keep one high-quality master and compress copies from it.
- Judging quality at thumbnail size. Compression damage shows in faces and fine texture. Check at 100%, then decide the quality level.
这个工具适合谁——以及它做不到什么
用于在「不出现可见损伤」的前提下把体积压到限制以内:邮件附件、上传表单、网站图片、即时通讯。真正该问的不是「能压多小」,而是「够这个平台用、同时还像原图」。
- 邮件附件限制。把 12 MB 的扫描件压到真的能发出去的大小。
- 有上限的上传门户。签证、保险、招聘表单对超过固定体积的文件直接拒绝。
- 更快的网页。图片通常是最大的资源;在显示尺寸下,适度降质是看不出来的。
毁掉效果的常见错误,以及各自的解法
- 先压缩后修图。JPEG 伪影会被固化,再被对比度与锐化放大。先修,最后压缩。
- 同一个 JPEG 反复重压。每次保存都会叠加新的伪影。保留一份高质量母版,从母版生成压缩副本。
- 在缩略图尺寸下判断画质。压缩损伤体现在人脸和细纹理上。放大到 100% 看过,再决定质量档位。
Field Notes: Settings That Actually Work
Concrete starting values taken from the tool's own parameters, plus what to change when the first result is not right.
Compression numbers are easy to misread, and this page has two behaviours that explain most of the confusion. First, the size readout is computed by encoding your canvas as JPEG at the quality you picked — always JPEG, whatever format you then download. Second, the before/after slider draws raw canvas pixels on both sides, so it never shows the blocking a lossy encoder introduces. In practice that means the number is a close estimate for JPG, an overestimate for WebP, and an underestimate for PNG, while the picture you are judging is untouched.
The slider runs 0–100 and is converted to the encoder's own 0–1 scale; the default is 80, and the Web-Ready preset moves to quality 80 with a 1600 px max width, while Reset returns to quality 80 and no width limit. Max width only ever shrinks: it is applied only when the photo's own width exceeds the value, and the height follows the same ratio, so there is no separate height field and no way to enlarge. On the standard JPEG scale, each ten-point step halves or doubles the quantisation step above 50, and encoded size tracks it closely — quality 90 typically lands near twice the bytes of 80 on the same photo, while 70 sits near two thirds. Shrinking works on area, not length: a 4000 px photo capped at 1600 px keeps 0.4 × 0.4 = 16% of its pixels, so at unchanged quality the file drops to roughly a sixth.
| What you see | Start here | Why it works | If it is still wrong |
|---|---|---|---|
| The readout says 2 MB but the WebP file you downloaded is far smaller | Read the number as a JPEG estimate and download WebP when size matters most | The readout comes from a JPEG encode at the chosen quality, so it never reflects WebP's better compression | Download JPG if you want the number and the file to match; verify the real size in your file manager |
| The comparison slider shows no difference even at quality 55 | Judge quality by downloading and viewing the file, not by the preview | Both canvases are painted from the same uncompressed pixels; the encoder's artefacts never enter the preview | Keep a web copy around 75–85 and open it at 100% zoom on the page where it will actually appear |
| Saving is only about 8% on a photo that is already a small JPEG | Drop to quality 70, and add a max width of 1600 if the photo is larger than a web layout needs | The original is already lossy and well compressed, so there is little left for a second encoder pass to remove | If 70 still is not enough, cut the width instead — area scales with the square, so 1200 px keeps under 10% of a 4000 px photo's pixels |
| A 4000 px scan has to fit a 1600 px web layout | Max width 1600 with quality 80 | The long edge scales by 0.4, the pixel count by 0.16, so the bytes fall to roughly a sixth at the same quality setting | Still too heavy: quality 70 with the same width lands near a ninth of the original; keep the full-size file as your master |
Switch tools when compression is not the actual job. If the file is too big because it is also too large in pixels, Photo Resizer gives you an exact width and height instead of a width ceiling, which matters for print sizes. If you have a folder to shrink rather than one file, Batch Converter applies one quality and format across every row and can bundle the results as a zip. If the photo needs restoring before it is worth compressing, start in Photo Restorer, because compressing a faded scan only makes the fading harder to recover.
What this tool cannot do: it cannot show you the real compressed pixels, cannot compress PNG with the slider, cannot enlarge an image, cannot set width and height independently, and cannot store metadata — the re-encoded file carries no EXIF, so camera details and location are dropped. The readout can also be wrong in the opposite direction: re-encoding a small, already-optimised image at quality 90 or above can produce a file larger than the original, and the tool will label that result as larger rather than pretend it saved you anything.
Sources & further reading
- MDN Web Docs — Canvas API, for toDataURL and toBlob, which produce every size shown on this page.
- W3C — PNG (Portable Network Graphics) Specification, Third Edition, on why a lossless format ignores a quality value.
- Federal Agencies Digital Guidelines Initiative, on keeping a full-resolution master and deriving smaller access copies from it.
压缩数值很容易被误读,而这个页面有两个行为能解释大部分困惑。第一,体积读数是把画布按你选的质量编码成 JPEG 得来的——不管最后下载哪种格式,它算的始终是 JPEG。第二,前后对比滑块两侧画的都是未压缩的画布像素,所以它永远看不到有损编码产生的色块。实际后果是:这个数字对 JPG 比较接近,对 WebP 偏大,对 PNG 偏小,而你正在判断的那张图本身没被动过。
滑杆范围 0–100,编码前换成编码器的 0–1;默认 80。「网页档」预设把质量设为 80、最大宽度 1600,Reset 则回到质量 80、不限宽度。最大宽度只会缩小:只有当照片自身宽度超过该值时才生效,高度按同一比例跟随,所以没有单独的高度输入,也不可能放大。在标准 JPEG 质量刻度上,50 以上每 10 分会让量化步长减半或翻倍,体积也随之变化——同一张照片,质量 90 的体积通常是 80 的两倍左右,70 则是 80 的三分之二左右。缩放作用于面积而不是长度:4000px 的照片限制到 1600px,只剩 0.4 × 0.4 = 16% 的像素,所以在质量不变时体积大约降到六分之一。
| 你看到的现象 | 先用这组值 | 为什么有效 | 还是不对怎么办 |
|---|---|---|---|
| 读数显示 2MB,下载的 WebP 却小得多 | 把这个数字当作 JPEG 估算值;最在意体积时下载 WebP | 读数来自按当前质量进行的 JPEG 编码,因此体现不了 WebP 更强的压缩 | 想让数字与文件一致就下载 JPG;再到文件管理器确认实际大小 |
| 质量拖到 55,对比滑块仍看不出差别 | 靠下载后实际查看判断画质,别靠预览 | 两块画布都画自同一份未压缩像素,编码产生的伪影进不了预览 | 网页用图保持在 75–85,在真正展示它的页面上按 100% 查看 |
| 本来就是小 JPEG 的照片,只省了约 8% | 降到质量 70;如果照片远大于网页所需,再把最大宽度设成 1600 | 原图已经有损且压得较狠,第二轮编码几乎没有可删的东西 | 70 还不够就改宽度——面积按平方缩放,1200px 只保留 4000px 照片不到 10% 的像素 |
| 4000px 的扫描件要放进 1600px 宽的网页 | 最大宽度 1600,质量 80 | 长边缩到 0.4、像素量缩到 0.16,同质量下体积大约降到六分之一 | 仍然太重:同宽度把质量降到 70,约剩原来的九分之一;原始大文件留作母版 |
当真正要做的不是压缩时,换工具。文件大是因为像素多,用照片缩放可以给出精确的宽高,而不是一个宽度上限——打印尺寸尤其需要这样。批量转换适合一整个文件夹统一质量与格式,并能打包成 zip。照片本身还需要修复再考虑压缩,先去照片修复,因为把一张褪色扫描件压小,只会让褪色更难救回来。
这个工具做不到什么:它不能展示真实的压缩像素,不能让滑杆压缩 PNG,不能放大图片,不能分别设定宽与高,也不保留元数据——重编码后的文件没有 EXIF,相机参数与位置信息都会丢失。读数也可能往反方向出错:把一张本来就压得很小、优化过的图片按 90 以上重编码,结果可能比原件还大,此时工具会明说「结果比原图更大」,而不是假装帮你省了体积。
参考来源与延伸阅读
- MDN Web Docs — Canvas API:本页所有体积数据都来自 toDataURL 与 toBlob。
- W3C — PNG 规范(第三版):无损格式为何忽略质量参数。
- 美国联邦机构数字化指南(FADGI):保留全分辨率母版,再由母版派生较小的访问副本。
FAQ
Does compressing my photo upload it?
How much can I shrink a photo?
Why is PNG not getting smaller?
Will compression hurt my photo?
Which format should I download?
压缩照片会上传它吗?
照片能缩小多少?
为什么 PNG 没有变小?
压缩会损伤照片吗?
该下载哪种格式?
Related Tools
Batch Converter
Apply the same compression and format to many photos at once.
对多张照片统一压缩与转格式。
Photo Resizer
Scale to exact pixels before you compress for the web.
网页压缩前先缩放到精确像素。
Photo Cropper
Crop away empty space to cut down the file size.
裁掉多余空间以减小文件体积。
Faded Photo Fixer
Enhance first, then export a compressed web copy.
先增强,再导出压缩后的网页副本。
Sepia & Vintage Tone
Apply a look, then compress for sharing.
先调色,再压缩用于分享。
Old Movie Effect
Style a photo, then make a small shareable file.
先做风格,再生成小巧的分享文件。
Related Guides
10 Photo Care Tips
Archive masters carefully, compress only the web copies.
妥善归档母版,只压缩网页副本。
Scanning Old Photos
Scan high, compress the shareable version down.
高分辨率扫描,再压缩分享版本。
Privacy-First Editing
Why compressing locally beats uploading to a web tool.
为什么本地压缩胜过上传到网页工具。
Film Scan Restoration
Tame huge film-scan files for the web.
把巨大的胶片扫描文件压到适合网页。