Images

Compress Image Guide: Quality, Dimensions, File Size and Original Fallback

·

Image compression aims to reduce encoded file size while keeping enough detail for the intended use. ToolMellow processes local JPG, PNG and still WebP images with a quality setting, output-format choice and optional maximum side length. Inspect the actual result size and image before downloading one file or a batch ZIP.

A lower quality value does not guarantee a particular number of bytes. This compressor also has an exact-original fallback: if a successfully encoded candidate is no smaller and keeps the actual format and decoded dimensions, the original file is returned unchanged. That distinction affects metadata, quality expectations and what a result labeled unchanged means.

Compress image

Choose images and compare a completed result

Use Choose images or drop supported files into the workspace. Preview reading starts locally; wait for it to settle before pressing Compress images. Defaults are Keep source format, quality 90, Maximum image side 0 and a white JPG background. The compressor has no target-byte input, crop rectangle or rotation/flip controls.

Choose a quality value, output format and optional maximum side, then process the batch. Each result shows its output size, source/output comparison, output dimensions and decoded source dimensions. Inspect fine details and the result label before downloading. Setting or queue changes clear previous generated results, so process again after making an adjustment.

  • Keep originals separately when experimenting with different quality or format choices.
  • Compare both encoded bytes and visible detail rather than judging the quality number alone.
  • Check the downloaded file against the actual threshold of the application where it will be used.

Supported still images and separate byte limits

Inputs are JPG, PNG or still WebP, validated by file headers and actual decoding. Animated PNG/WebP are rejected; GIF, SVG, HEIC, PDF and video are not supported here. Selecting a smaller output does not bypass the allocation checks on the full source. A supported-looking header can still fail if the file is damaged or the browser cannot decode it.

The source and encoded-candidate byte totals are separate budgets, and MB is decimal rather than MiB. The worker checks cumulative newly encoded candidate buffers before considering original-file fallback; returning a smaller original does not subtract that candidate from the already checked budget. A batch can therefore fail before an otherwise eligible original would be returned.

Supported still images and separate byte limits
BoundaryMaximum
Files per job20
Each input file25000000 bytes, inclusive
Each decoded source24000000 pixels
Either source side12000 pixels
Combined source files100000000 bytes, inclusive
Cumulative newly encoded candidates100000000 bytes, inclusive

MDN: File API and user-selected filesMDN: createImageBitmap orientation and decoding options

Quality is an encoder request, not a retained-detail percentage

Quality starts at 90 and ranges from 10 to 100. The worker passes the selected value divided by 100 to the browser encoder. For JPG or WebP, this can trade detail for bytes, but different images and encoders respond differently. A value of 50 does not mean half the bytes, half the pixels or exactly half the original quality.

For a photograph, try a lower setting and inspect text, edges and textured areas after processing. Higher quality can produce a larger candidate that triggers original fallback when format and dimensions are unchanged. There is no automatic search for a target file size, fixed compression percentage or guaranteed visual score. Compare the actual exported result.

MDN: OffscreenCanvas image encoding and quality

Maximum side limits size without enlarging images

Maximum image side accepts whole numbers from 0 to 12000. Zero keeps the decoded source dimensions. A positive value fits the image inside that maximum while preserving proportions as closely as integer pixels allow, and never enlarges a smaller source. A cap at or above the source’s longest side can leave its actual dimensions unchanged.

The tool scales both sides together and rounds output dimensions to positive whole pixels. Very small results can therefore approximate, rather than exactly preserve, the original ratio. The cap is not an exact width-and-height preset, percentage resize or crop. The source preview’s dimensions include browser-applied image orientation before this calculation.

Maximum side limits size without enlarging images
Decoded sourceMaximum sideActual output
4000 by 300004000 × 3000
4000 by 300012001200 × 900
600 by 4001200600 × 400
3 by 211 × 1

MDN: createImageBitmap orientation and decoding optionsMDN: Canvas drawImage source rectangles

When the exact original is returned

After successful decoding, rendering, encoding, MIME validation and candidate-budget checks, the compressor compares the candidate with the source. Original fallback requires the detected output type and actual decoded dimensions to remain the same, with no rotation or flips, and candidate bytes at least as large as source bytes. Equality also returns the original.

Keep source format is not the only eligible setting: an explicit choice matching the actual source type also qualifies. A positive maximum-side cap that does not reduce the source can still qualify. When the result says Original returned unchanged, its downloaded payload is the exact original bytes; the requested quality has not replaced that file’s original encoding. It still receives the generated download name.

When the exact original is returned
Candidate conditionReturned payload
Same format/dimensions; candidate largerExact original
Same format/dimensions; equal byte countExact original
Same format/dimensions; candidate smallerNew encoded candidate
Actual dimensions or format changedNew candidate, even if larger

Choose format deliberately and allow for larger results

Keep source format detects each input’s actual header type. Explicit JPG, PNG or WebP applies one output type to the batch; mixed inputs may otherwise keep different formats. A format change or actual dimension change disables original fallback, so the requested new candidate is exported even if it uses more bytes than the source.

Converting a photograph from JPG to PNG can increase size because PNG losslessly encodes the rendered pixels rather than repeating the source’s lossy encoding. WebP may reduce bytes for some content but is not guaranteed to win. The worker checks the actual encoded MIME type and reports unsupported encoding instead of silently naming a fallback PNG as another format.

Choose format deliberately and allow for larger results
OutputWhat to expect
JPGOpaque lossy image using the JPG background where alpha existed
PNGLossless rendered-canvas encoding with alpha; no lossy quality parameter
WebPBrowser-supported encoding with alpha and a quality request

MDN: OffscreenCanvas image encoding and quality

PNG quality controls and lossless scope

Explicit PNG selection disables the quality slider. Under Keep source format the slider can remain visible and enabled for a PNG input or mixed batch, but PNG encoding ignores the lossy quality parameter. This compressor does not offer PNG palette-size tuning or a dedicated PNG optimizer; lowering the slider alone does not request more PNG compression.

PNG losslessness describes encoding of the rendered canvas. Browser decoding, color/alpha conversion and any resizing distinguish that canvas from the original encoded image. A new PNG does not recover detail already lost in a JPG source or certify the original color profile, hidden RGB values of transparent pixels or source-byte identity. Exact-original fallback is the separate case that preserves source bytes.

MDN: createImageBitmap orientation and decoding optionsMDN: OffscreenCanvas image encoding and quality

Transparency and the selected JPG background

PNG and supported WebP candidates retain transparency through canvas rendering. JPG cannot retain alpha, so JPG background fills the output before the image is drawn. It starts white; select another background when flattening a transparent image. Changing that color has no flattening role for PNG or WebP output.

Inspect translucent edges on the surface where the image will appear. Converting an alpha image to JPG changes the format, so it exports a new candidate rather than retaining a transparent original through fallback. For a returned original, the original file’s transparency and metadata remain intact; the candidate is not substituted merely because another quality value was selected.

MDN: OffscreenCanvas image encoding and quality

Metadata differs between a new candidate and an unchanged original

A newly rendered and encoded result does not copy the source camera, location or other original metadata through this compressor. Canvas encoders may write their own format metadata, so a new candidate is not a guarantee of a metadata-free file. Browser handling also does not certify a color-managed print workflow.

Exact-original fallback retains all original bytes, including any source EXIF, location data, profiles and orientation tags. The UI reports decoded, oriented dimensions even when that original payload keeps its encoded header and orientation metadata. Compression is therefore not a metadata-removal control. Read the unchanged label and verify the payload separately when metadata is part of your requirement.

MDN: createImageBitmap orientation and decoding optionsMDN: OffscreenCanvas image encoding and quality

Interpret smaller, larger and rounded size comparisons

The comparison uses actual returned-payload bytes against source-file bytes. If source is S and result is R, smaller percentage is (1-R/S) × 100; for a larger result the interface shows the positive magnitude of that difference with a larger label. Original fallback produces unchanged status rather than pretending the rejected candidate is the download.

B values below 1000 display as whole bytes; KB and MB use decimal divisors and one decimal place. Size-change percentages also display one decimal place. Rounded displays can hide a tiny difference: a one-byte reduction from 100000 bytes is only 0.001%, which rounds to 0.0% smaller. Use the downloaded byte count for an exact threshold.

Interpret smaller, larger and rounded size comparisons
Source bytesResult bytesComparison
1000006000040% smaller
100000100000Same size; original fallback when eligible
10000012500025% larger
100000999990.001% smaller; display rounds

Work toward a threshold without an exact-size guarantee

To aim below a required threshold, first decide whether its units mean decimal KB or binary KiB and whether its allowed formats and dimensions permit changes. Choose a suitable format, reduce quality for JPG/WebP if acceptable, or lower the maximum side. Process and inspect the downloaded result; there is no target-100-KB field or automatic byte fitting.

If output remains too large, change one setting and compare again while returning to the original source for experiments. Source-format/same-size fallback can retain the original when a candidate is no improvement; actual resizing or format conversion exports the new result even if larger. A tiny target may not retain enough detail for the intended use. This is a manual tradeoff, not a guaranteed route to every target.

Manage a batch and download the returned files

Quality, maximum side, output format and JPG background apply to every image in the job. Move up/down, Remove, Sort by filename and Reverse order change the queue and clear prior results. Sorting uses the interface language with numeric comparison and base sensitivity; it does not promise a universal bytewise order for all filenames.

Results use cleaned source basenames, a new extension and queue prefix, such as 01-photo.jpg. Each has Download, Resize image and Make a PDF actions. More than one result enables Download all as ZIP, named toolmellow-images.zip, and Make one PDF for the batch. ZIP stores the returned files, including exact-original payloads where applicable, and wrapper overhead can add bytes beyond their sum.

MDN: localeCompare and language-sensitive ordering

Handle failed jobs, cancellation and retained settings

The batch result list is displayed only after every image succeeds. A source, decoder, encoder or budget failure prevents a partial completed batch from being shown. Remove an unsupported or damaged input, adjust a setting or use a smaller batch, then run again. Preview failures do not bypass validation; processing validates the actual source and requested output.

Jobs have a 60-second timeout for the whole batch. Cancel terminates processing while keeping selected files. Clear files removes the queue, previews and generated results while retaining quality, maximum side, format and background; a new batch uses those retained settings. Downloaded files are not deleted, and changing a setting does not automatically process another result.

MDN: Using Web WorkersMDN: Worker termination

Local processing and review of generated files

You choose files on the device; preview reading and compression run in a local browser worker. This tool has no remote-image URL importer or server image-compression endpoint, and it does not persist an edit project. Ordinary hosting, asset and analytics requests are separate from the image-byte processing; local computation is not an anonymity or zero-logging claim.

Keep the original and inspect the actual result before replacing it. Resize/PDF actions make a deliberate one-time in-memory handoff of the returned files in the same tab; destination settings and limits remain separate. Refreshing or leaving discards the compressor workspace. These actions do not establish that an image’s content, metadata or profile is suitable for another application.

MDN: File API and user-selected filesMDN: Using Web Workers

Embed the compressor with a visible ToolMellow backlink

Use Add this tool to your website on the localized tool page to copy or download the supplied HTML snippet. Retain its interactive iframe, sizing behavior and visible ToolMellow backlink, including the existing link attributes. Choose the intended language and enough frame space for visitors to inspect the controls and results.

Visitors select their own files and receive the same formats, job limits and original-fallback behavior. The embed is not an API for automatically compressing images hosted by your page. Test it in the browsers and layout you use, and keep the ToolMellow credit link visible. Embedding alone does not prove search rankings or citations.

Common questions

How do I compress an image online?

Choose local JPG, PNG or still WebP files, set quality, output format and optional maximum side, then press Compress images. Compare the returned size and image before downloading one file or a ZIP.

Why was my original image returned unchanged?

After successful encoding and budget checks, the candidate was no smaller while its actual format and decoded dimensions stayed the same. The exact original payload is returned, including original metadata; equal candidate size also qualifies.

Does lower quality guarantee a smaller file?

No. It is a browser encoder request for JPG/WebP, not a file-size or retained-detail percentage. PNG ignores that lossy parameter, and original fallback can retain a source whose candidate is no improvement.

Can I compress an image to exactly 100 KB?

There is no exact-byte target field or guaranteed target output. Adjust quality, maximum side or format when acceptable and compare downloaded bytes. Verify whether the receiving limit uses KB or KiB.

How does maximum image side affect dimensions?

Zero keeps decoded dimensions. A positive whole-number cap fits the image within that side without enlarging it, rounding to whole pixels. A cap above the source can leave actual dimensions unchanged and still permit original fallback.

Does PNG compression use the quality slider?

PNG ignores the lossy quality request. Explicit PNG disables the slider; Keep source format can leave it enabled for a PNG or mixed batch. The tool has no PNG palette-size optimizer control.

Will compression remove location metadata?

A new encoded candidate does not copy original camera/location metadata, but an exact original returned unchanged retains every source byte and its metadata. The compressor is not a guaranteed metadata-removal workflow.

Can a resized or converted image be larger?

Yes. Actual dimension or format changes export the candidate even if its encoded bytes increase. Inspect its result size. Selecting a positive maximum side without changing dimensions is a different case that can still return the original.

How is the percentage size reduction calculated?

It compares actual returned bytes with source bytes: (1-result/source) × 100. Larger results show the positive magnitude with a larger label. The display rounds to one decimal; downloaded bytes decide exact limits.

Can I compress transparent PNG or WebP images?

Yes, supported PNG/WebP candidates retain alpha through rendering. JPG flattens transparency onto the chosen JPG background. Original fallback preserves the original file, and format changes generate a new candidate.

What limits apply to a batch?

Up to 20 files, 25000000 bytes each, 24000000 decoded pixels and 12000 pixels per side, with 100000000 combined source bytes. Newly encoded candidate buffers also have a cumulative 100000000-byte budget checked before original fallback.

Can I embed the image compressor?

Yes. Copy the localized HTML from Add this tool to your website, keep its iframe and visible ToolMellow backlink, and test the frame in your page. Visitors still choose and process their own local files.

Is compression lossless for every input?

No. PNG encodes the rendered canvas losslessly, but decoding/resizing can differ from original data; JPG/WebP can lose detail. Exact-original fallback preserves original bytes only when its conditions and earlier checks pass.

Does changing a setting update my existing download?

No. It clears the generated result, and you must process again. Clear files removes files/previews/results while retaining output settings. Neither clearing nor cancelling deletes files already downloaded.

Sources and further reading

Put it into practice.

Related guides