Crop Image Guide: Exact Pixels, Aspect Ratios, Rotation and Export
Admin ·
Cropping keeps a rectangular part of an image and removes the surrounding area from the output. ToolMellow opens one local JPG, PNG or still WebP, lets you drag a selection or enter exact pixel coordinates, and exports the crop with optional quarter-turn rotation and flips.
A crop ratio describes shape; pixel width and height describe resolution. The tool selects from the browser-decoded, oriented source and then re-encodes the result. This guide explains the actual coordinate rules, preset rounding, transform order, transparency and download behavior so you can check the exported file against your intended use.
Choose one image and create a crop
Use Choose images or drop one supported image into the workspace. A local worker reads a preview; wait for it before using the crop controls. The initial selection covers the whole decoded image, with Free aspect ratio, Keep source format, zero rotation, both flips off, quality 90 and a white JPG background.
Drag a new rectangular selection or enter Crop X, Crop Y, Crop width and Crop height. Check the source-to-output dimension line, press Crop image and inspect the result preview. Download saves the generated file; changing a crop or output setting clears the previous result, so process again before downloading the revised version.
- Keep the original file separately before trying different crop choices.
- Check the selected subject and exact output dimensions before exporting.
- Review the downloaded result in the application or webpage where it will be used.
Supported images and allocation limits
The cropper accepts one JPG, PNG or still WebP. Validation inspects the file header rather than trusting the extension. Animated PNG and animated WebP are rejected; GIF, SVG, HEIC and other unsupported inputs need a supported still-image export first. Renaming an extension does not convert a file.
The byte ceiling is decimal: 25,000,000 bytes, inclusive, rather than 25 MiB. Header dimensions and actual decoded dimensions are checked. A valid-looking header can still fail decoding if the file is corrupt or the browser cannot read it. The image must also fit the pixel-area and per-side limits below. Encoded output is also limited to 100,000,000 bytes, even though this cropper accepts only one input; a large PNG can use more bytes than its compressed source.
| Boundary | Maximum or condition |
|---|---|
| Selected input | One image |
| File bytes | 25000000 bytes, inclusive |
| Decoded area | 24000000 pixels |
| Either decoded side | 12000 pixels |
| Encoded output | 100000000 bytes, inclusive |
MDN: File API and user-selected filesMDN: createImageBitmap orientation and decoding options
Crop by exact pixels in the oriented source
Crop X and Crop Y specify the top-left corner in the full decoded, oriented image. X increases to the right and Y increases downward, beginning at zero. Crop width and Crop height count the selected pixels. These values refer to the source dimensions, not to the smaller on-page preview or the eventual rotated output.
The final crop requires whole numbers and a positive width and height. X plus width must not exceed the source width; Y plus height must not exceed the source height. Numeric fields do not silently clamp an out-of-bounds rectangle during export. Correct the values instead of treating an invalid boundary as a padded crop.
| Value | Required rule |
|---|---|
| Crop X and Y | Whole numbers at least 0 |
| Crop width and height | Whole numbers at least 1 |
| Right edge | x + width <= sourceWidth |
| Bottom edge | y + height <= sourceHeight |
MDN: createImageBitmap orientation and decoding optionsMDN: Canvas drawImage source rectangles
Aspect ratios set shape, not a fixed resolution
Crop aspect ratio offers Free, 1:1, 4:3, 3:4, 16:9 and 9:16. Choosing a ratio replaces the current selection with a large centered rectangle in the source. The preset calculation floors its candidate width, rounds the derived height and floors the centering offsets, so integer rounding can make the selected ratio approximate.
With a fixed ratio selected, editing width derives height and editing height derives width. Moving X or Y does not automatically reduce the rectangle to fit the remaining space. Dragging follows the chosen ratio within image bounds, subject to pixel rounding and edge clipping. Free and Use whole image reset to the full source and remove the fixed ratio; Free does not preserve a previous small crop.
| Choice | Width-to-height shape |
|---|---|
| Free | Independent rectangle; choosing it resets to the whole image |
| 1:1 square | Equal width and height |
| 4:3 landscape | Width greater than height |
| 3:4 portrait | Height greater than width |
| 16:9 landscape | Wide rectangle |
| 9:16 portrait | Tall rectangle |
Worked examples for a 1200 by 800 source
The examples use a decoded source measuring 1200 by 800 pixels, with zero rotation and no flips unless specified. Presets select pixels already present in the source; choosing 16:9 does not resize the image to 1920 by 1080. Use Image resizer separately when you need another output resolution.
The 16:9 example leaves 62 pixels above and 63 below because centering uses a whole-pixel floor. A rectangle can touch the right or bottom edge exactly. Extending it one pixel farther fails validation rather than inventing additional source pixels.
| Selection | Coordinates or result | Meaning |
|---|---|---|
| 1:1 preset | x=200, y=0, width=800, height=800 | Centered square |
| 16:9 preset | x=0, y=62, width=1200, height=675 | Whole-pixel centered landscape |
| 9:16 preset | x=375, y=0, width=450, height=800 | Centered portrait |
| Manual right-edge crop | x=1000, y=100, width=200, height=300 | Ends exactly at source X=1200 |
| That manual crop plus 90° | 300 × 200 output | Quarter turn swaps the cropped dimensions |
Use dragging or numeric controls deliberately
The crop stage displays a bounded preview and a rectangular outline. A pointer drag starts a new selection between its start and end positions; it is not a dedicated move handle for the existing rectangle. Pointer positions map back to full source pixels and are rounded. Dragging in either direction works, and edge bounds keep the selection inside the image.
Use the numeric controls when you need reproducible coordinates or an alternative to dragging. Record X, Y, width and height, together with the later rotation and flip choices. A visually plausible outline alone does not prove that fractional or manually moved coordinates are valid; confirm the expected dimension line and process the crop.
Crop first, then rotate, then flip in the output axes
Crop selection uses the decoded source before the rotation controls. Rotate clockwise offers 0, 90, 180 or 270 degrees. The selected source rectangle is transformed for the output; a 90- or 270-degree turn swaps width and height, while 0 and 180 retain them. There is no arbitrary-angle crop rotation here.
Flip horizontally after rotation and Flip vertically after rotation reflect the rotated result in its current axes. This order matters for an asymmetric subject. The source selection outline remains in source coordinates, so inspect the processed output to confirm the final orientation. Cropping does not modify the original file.
| Stage | Applied to |
|---|---|
| Decode orientation | Source image orientation metadata when supported by the decoder |
| Crop | Rectangle in decoded, oriented source coordinates |
| Clockwise rotation | Selected rectangle; quarter turns swap dimensions |
| Horizontal/vertical flip | Axes of the rotated output |
Choose JPG, PNG or WebP for the cropped result
Output format starts as Keep source format. The actual source type is detected from its header, and the tool re-encodes the cropped pixels in that type. You can explicitly choose JPG, PNG or WebP instead. Keep source format preserves the format choice; it does not return the original bytes, preserve its camera metadata or avoid encoding.
PNG and WebP retain transparent pixels through the supported canvas export. JPG cannot retain alpha, so the selected JPG background fills the output before the crop is drawn. The background starts white and has no flattening role for PNG or WebP. Check translucent edges against the background where the image will appear.
| Output | Practical choice |
|---|---|
| JPG | Opaque photograph; transparent pixels flatten onto JPG background |
| PNG | Lossless canvas encoding with alpha |
| WebP | Browser-supported encoding with alpha and a quality setting |
Understand re-encoding, quality and metadata changes
Quality ranges from 10 to 100 and starts at 90. It is passed as a quality request to the browser encoder for JPG or WebP, not as a percentage of original detail retained or a guaranteed file-size reduction. Explicit PNG selection disables the quality control; Keep source format with a PNG can still show the control, but PNG encoding does not use the lossy quality setting.
Every successful crop is re-encoded, even if you keep the whole image and source format. Original camera/location metadata is not copied by this cropper. Canvas export can write its own format metadata, so this is not a promise of a metadata-free file. Browser decoding, color conversion and encoding can alter representation; repeated JPG or lossy WebP exports can lose detail. Keep the original for further edits.
MDN: createImageBitmap orientation and decoding optionsMDN: OffscreenCanvas image encoding and quality
Compare the preview, dimensions and actual download
The input preview is a resized PNG representation, with its longest side at most 640 pixels and no enlargement of smaller inputs. Its reported width and height still describe the full decoded source. The worker processes that source for export; the small preview does not limit the crop to 640 pixels or certify every source pixel’s color.
The result card displays the actual encoded byte size, output dimensions and source dimensions. For an input called photo.png exported as JPG, the generated name is 01-photo.jpg; filenames are cleaned and their basename is bounded before the new extension is added. The cropper produces one result and one Download action, so a batch ZIP is not part of its normal one-image workflow. Cropping can produce a larger file when format or encoding changes.
Fix invalid coordinates and unsupported exports
If the expected-size line reports an invalid rectangle, check that all four values are whole numbers and that both far edges fit inside the source. The worker validates the rectangle again when you press Crop image. A fixed-ratio width change may derive a height that is too large for the chosen Y, so adjust the crop or reset with Use whole image.
If reading fails, keep your source and try a fresh supported still export within the limits. If the requested encoder is unsupported, the tool checks the resulting MIME type and reports an error instead of silently calling a fallback PNG a JPG or WebP. A worker or time-limit error calls for a smaller supported input or reloading; the permitted maxima do not guarantee success on every device.
| Problem | What to check |
|---|---|
| Outside-image or fractional crop | Whole numbers, positive dimensions and both far edges |
| Cannot read source | Supported header, still image, valid encoding and limits |
| Cannot encode selected format | Try supported JPG or PNG and inspect the new result |
MDN: OffscreenCanvas image encoding and qualityMDN: Using Web Workers
Settings, clearing and cancellation have separate effects
Changing crop coordinates, aspect ratio or output settings clears the previous generated result. It does not automatically export another file. Clear files removes the selected image, its previews and generated results, and resets the crop; it retains output choices such as format, quality, rotation, flips and background. Use whole image only resets the selection and fixed ratio, leaving those output choices intact.
To replace the source, clear or remove the existing file first; trying to add another image is rejected while one is already selected. During processing, Cancel terminates the local worker and leaves the original input available. Jobs have a 60-second timeout. Clearing or cancelling does not remove a file already downloaded to your device. Refreshing or leaving the tool discards the workspace state.
Local image processing and deliberate tool handoffs
The selected image is read, previewed, cropped and encoded by the local browser worker; this cropper has no remote-image URL importer or image-upload calculation service. Files and options are held in workspace memory rather than persisted as an edit project. Ordinary website hosting and analytics requests remain separate from that image workflow; local processing does not mean anonymous browsing or zero logs.
After a successful export, Resize image or Make a PDF passes the generated file through a deliberate one-time handoff in the same tab. It does not change the source crop into a multi-image job. The destination tool has its own settings and limits. Download the reviewed result if you need to retain it independently of the current page.
Choose the crop for the intended composition
For a square thumbnail, place the important subject inside a 1:1 selection and inspect the borders before exporting. For a wide header or tall illustration, start with 16:9 or 9:16, then enter exact coordinates if the automatic centered selection cuts off text or a face. A preset cannot identify the subject for you. Keep enough surrounding context for the image’s meaning.
Cropping leaves content outside the selected rectangle out of the exported image; resizing changes dimensions. A rectangular cropper does not create a circular mask, remove a background, extend missing edges or enforce a platform’s current upload specifications. If another site needs exact dimensions, use Image resizer after cropping and check that site’s requirements. PNG can retain existing transparency, but selecting PNG does not create transparent corners around a circular subject.
Embed the interactive cropper with its visible backlink
Use the Add this tool to your website section on the localized tool page to copy the supplied HTML snippet. It contains an iframe for the same interactive cropper and a visible ToolMellow backlink. Retain the credit link, its target and the existing rel attributes when adding the snippet to your webpage. Pick the desired article/tool language before copying its localized embed.
The embedded tool uses the same one-image controls, limits and local processing; it is not an API for automatically cropping the host page’s images. Visitors choose their own file and download their own output. Give the iframe usable dimensions, test it in the intended browsers and keep the backlink visible. Embedding alone does not establish search rankings or citations.
Common questions
How do I crop an image online?
Choose one JPG, PNG or still WebP, wait for its preview, drag a rectangle or enter coordinates, then press Crop image. Check the result dimensions and download the generated file.
How do I crop an image by exact pixels?
Enter zero-based Crop X and Crop Y plus positive whole-number width and height. Both far edges must fit inside the decoded, oriented source. The coordinates do not refer to the smaller displayed preview.
Does a fixed aspect ratio set an exact output size?
No. It selects a shape from existing source pixels. Whole-pixel rounding can approximate the ratio, and a later quarter turn swaps dimensions. Use Image resizer separately for a different exact resolution.
Why is my crop outside the image?
Check X plus width and Y plus height against the source dimensions. Moving the crop origin or deriving a dimension under a fixed ratio does not silently clamp manual values during export. Fractions and zero-sized crops are also invalid.
Does cropping happen before rotation and flips?
Yes. The tool crops the oriented source, rotates that rectangle by the selected quarter turn, and applies flips in the rotated output axes. Inspect the processed result rather than judging only the source outline.
Can I crop a transparent PNG?
Yes. PNG output retains existing alpha, and WebP can also retain alpha with supported encoding. JPG flattens transparency onto the chosen JPG background. Cropping remains rectangular and does not create a circular mask.
Does Keep source format preserve the original file?
No. It selects the detected input format for re-encoding. Even a whole-image crop produces new encoded output and does not copy original camera metadata. Keep the original separately.
Will cropping make my file smaller?
It often removes pixels, but encoded size also depends on format, transparency, content and browser quality choices. The output can be larger. Compare actual result bytes; this cropper has no target-size guarantee.
Why does my photo open with a different orientation?
The decoder requests orientation from the image metadata when present. Crop coordinates describe that decoded, oriented image. Your later rotation and flips are additional transforms, not edits to the source EXIF tag.
Which image formats and limits are supported?
One JPG, PNG or still WebP, at most 25000000 bytes, 24000000 decoded pixels and 12000 pixels on either side. Encoded output is limited to 100000000 bytes. Animated PNG/WebP and unsupported types are rejected. A supported header still needs to decode successfully.
Can I crop a circle or crop several images at once?
This workspace selects one rectangular crop from one image. It has no circular/free-shape mask or batch crop. Existing PNG transparency can survive an export, but that is different from adding a new shape mask.
Can I embed this image cropper?
Yes. Copy the localized HTML snippet from Add this tool to your website, keep the interactive iframe and visible ToolMellow backlink, and test the dimensions on your webpage. Visitors still choose and process their own file.
Is my image uploaded for cropping?
Image reading, crop transforms and encoding run locally in a browser worker. Ordinary website hosting/analytics remain separate. The tool does not save an edit project or provide an anonymity guarantee.
What do Clear files and Use whole image reset?
Clear files removes the image, previews, result and crop while retaining output settings. Use whole image resets the selection and ratio only. Neither action deletes downloaded files; changing a setting requires a new Crop image operation.