Cropped Image
{{ outputWidth }} × {{ outputHeight }} • {{ outputSizeKB }} KB
{{ originalWidth }} × {{ originalHeight }} Source {{ savingPercent }} % Smaller {{ formatLabel }}
Source Image

{{ dropZoneText }}

:
{{ qualityPct }} %
0 keeps crop width
0 keeps crop height
Crop source
Original
Original
{{ originalWidth }} × {{ originalHeight }} • {{ originalSizeKB }} KB
Cropped
Cropped
{{ outputWidth }} × {{ outputHeight }} • {{ outputSizeKB }} KB
  • {{ r.label }}
    {{ r.value }}

            

Introduction:

Image cropping selects a rectangular portion of a picture to control composition, aspect ratio, and pixel dimensions while improving consistency across platforms. Rotation, flipping, and zoom refine orientation and framing without altering underlying content. Consistent crops help banners, thumbnails, and product photos align across channels and reduce file size for faster delivery and predictable layouts in responsive contexts.

You load an image locally, choose a free, original, fixed, or custom ratio, and optionally set target width or height. A client-side canvas renders the region with smoothing, then exports PNG, JPEG, or WebP. The tool reports dimensions and estimated size, and can generate JSON or CSV summaries describing inputs, crop geometry, and output characteristics for documentation or automation.

For example, crop a portrait to 4:5 for a marketplace listing, then export a 1200×1500 JPEG with a white background and moderate quality. Avoid heavy upscaling; enlarging beyond the crop’s native resolution reduces sharpness and may introduce compression artifacts that are visible on high-density displays.

Technical Details:

Concept overview

Digital cropping constrains an image to a user-defined rectangle, then optionally rescales that region to requested output dimensions. Two ideas govern results: aspect ratio, the proportional relationship between width and height, and resampling, which estimates new pixel values when scaling. Output encoding further affects size and quality: PNG is lossless and supports transparency; JPEG and WebP can be lossy and use a tunable quality factor.

Core equation and process

Aspect ratio r is width divided by height.

r=wh

Let the crop rectangle be Wc by Hc. If you request an output width Wo (height optional), the scale factor is:

s=WoWc

If instead you specify only height, use s = Ho / Hc. Output dimensions follow:

Wout=round(Wc×s) , Hout=round(Hc×s)

The processing sequence is: choose ratio; position crop; compute scale from requested dimension(s) or keep native; render the cropped region to a canvas with high-quality smoothing; encode to the selected format using a quality factor (where applicable) and an optional background color for non-alpha encoders.

Interpretation and output semantics

Format Compression Transparency Quality control Typical use
PNG Lossless Yes Not applicable Logos, UI, graphics needing crisp edges
JPEG Lossy No Quality factor (10–100%) Photos where small files are preferred
WebP Lossy or lossless Yes Quality factor (10–100%) for lossy Modern web delivery with good efficiency

PNG ignores the quality slider and preserves transparency. JPEG and lossy WebP apply the chosen quality factor; transparent pixels are composited onto the selected background color before encoding.

Variables and parameters

Parameter Meaning Unit/Datatype Typical range Notes
aspect Free, original, fixed, or custom ratio String free · original · 1:1 · 16:9 · 4:3 · 3:2 · 2:3 · custom Custom uses ratioW:ratioH
ratioW, ratioH Custom ratio components Positive integers 1–100 Used only when aspect is custom
outputWidthReq Requested output width; 0 keeps crop width Pixels 0–8192 Height auto-scales if only width is set
outputHeightReq Requested output height; 0 keeps crop height Pixels 0–8192 Width auto-scales if only height is set
format Export MIME type image/png · image/jpeg · image/webp Determines encoder and alpha handling
quality Encoder quality factor Number (0.10–1.00) 0.10–1.00 Ignored by PNG; mapped from 10–100%
bgColor Background used for non-alpha formats Hex color #000000–#FFFFFF Fills transparent pixels for JPEG/WebP

Worked example

Example: Original 4000×3000; crop to 4:3 region 2400×1800; request width 1200; export JPEG quality 85%.

Aspect ratio:

r=43=1.333

Scale from requested width:

s=12002400=0.5

Output dimensions:

Wout=2400×0.5=1200, Hout=1800×0.5=900

The resulting file is 1200×900; final bytes depend on image content and encoder quality.

Assumptions & limitations

  • Quality controls are encoder-specific; PNG ignores quality.
  • Resampling can soften fine textures; sharpening is not applied.
  • Transparency is not preserved in JPEG; transparent areas are composited onto the chosen background color.
  • Upscaling cannot invent detail; very large targets may look soft.

Edge cases & error sources

  • Extremely small crops may collapse to 1–2 pixels after scaling.
  • Very large requested sizes can exceed device canvas limits.
  • EXIF orientations are normalized; unexpected orientation metadata may change initial framing.
  • Highly compressed sources can exhibit banding that worsens on re-encoding.

Scientific validity & references

Behavior aligns with the HTML Canvas 2D Context processing model for drawing and encoding, ISO/IEC 10918-1 (JPEG), the PNG Specification (ISO/IEC 15948), and published descriptions of WebP lossy/lossless compression. Standard digital resampling principles apply, including interpolation and antialiasing used by common imaging systems.

Privacy & compliance

This concept processes image content locally and can include personal data visible within images; consider GDPR and CPRA obligations for any downstream handling outside the browser.

Step-by-Step Guide:

Use this sequence to prepare a consistent, web-ready crop.

  1. Load an image from your device. Large, high-quality sources yield better results.
  2. Choose an aspect ratio: free, original, a fixed preset, or custom with ratioW and ratioH.
  3. Position and size the crop; rotate or flip if needed to correct orientation or mirror a composition.
  4. Optionally set Output width or Output height; leave one at 0 to auto-scale and preserve ratio.
  5. Select Format: PNG for transparency, JPEG for small photos, WebP for efficient delivery.
  6. For JPEG/WebP, set Quality and a Background color to replace transparent pixels.
  7. Export and review the preview, dimensions, and estimated size; repeat adjustments until you meet requirements.
  8. If any dimension is unexpectedly zero, check that the crop area is larger than a few pixels and that requested sizes are within device limits.

FAQ:

Is my data stored?

No. Processing occurs entirely in your browser on a client-side canvas. Nothing is uploaded to a server, and object URLs exist only within your session.

Why does PNG ignore quality?

PNG uses lossless compression; there is no tunable quality factor. The slider applies only to lossy encoders such as JPEG and WebP in lossy mode.

How do aspect ratios work?

A ratio fixes width-to-height proportion. Custom values such as 5:4 or 3:2 maintain composition across sizes by constraining the crop box to that proportion.

What happens to transparency in JPEG?

JPEG does not support an alpha channel. Transparent pixels are flattened onto your chosen background color before encoding, producing fully opaque output.

Can I upscale safely?

Moderate upscaling is acceptable but cannot add detail. Keep targets close to the crop’s native size to avoid softness and amplified compression artifacts.

Why does size vary by image?

Encoders analyze content. Flat colors and simple textures compress smaller, while noise, grain, and fine detail produce larger files at the same quality setting.

Troubleshooting:

  • Exported file looks soft: reduce upscaling or increase quality for JPEG/WebP; prefer a larger source image.
  • Transparency lost: switch to PNG or WebP with alpha, or choose a suitable background color for JPEG/WebP.
  • Wrong orientation: rotate before exporting; check device auto-rotation metadata.
  • Unexpected aspect: verify preset versus custom values; reset to “original” to mirror source proportions.
  • Sizes show “0”: ensure the crop is larger than a few pixels and that requested dimensions are within hardware limits.

Advanced Tips:

  • Tip Match marketplace or social specs by saving preset ratios you reuse frequently in your workflow notes.
  • Tip For portraits, leave headroom above subjects; fixed ratios help maintain consistent eye-line placement across a series.
  • Tip Prefer WebP for modern web delivery; compare visual quality at similar dimensions to reduce bytes without sacrificing clarity.
  • Tip When replacing backgrounds for JPEG, pick a color already present in the image to minimize halos along high-contrast edges.
  • Tip Use moderate downscaling steps; extreme reductions can smear detail. Export at target display size instead of relying on CSS scaling.

Glossary:

Aspect ratio
Width divided by height; controls image proportions.
Crop rectangle
Selected region of the source image to retain.
Resampling
Interpolation used when scaling pixels up or down.
Alpha channel
Per-pixel transparency stored alongside color.
Lossy compression
Reduces size by discarding detail; controlled by a quality factor.
Lossless compression
Reduces size without changing pixel values; reversible.
Canvas
Client-side drawing surface used to render and encode output.

Files are processed locally in your browser; nothing is uploaded.