Image Cropper

Auto Cropper — Screenshot & Image

Professional browser-based image cropping and pixel analysis tool

Upload Image

Drag & Drop image here or Browse

JPG, PNG, WEBP, GIF, BMP
15

Original Width
–
Original Height
–
Cropped Width
–
Cropped Height
–
File Size
–
Reduction
–
100%
Please upload an image or screenshot to begin auto cropping

Auto Cropper for Screenshot & Image

Automatically remove unnecessary empty borders and margins from screenshots and images. Upload an image, let the tool detect the meaningful content area, adjust the crop if needed, and download the result.

Your image is processed locally in your browser and is not uploaded to a server.
'); win.document.close(); setTimeout(function(){try{win.focus();win.print();}catch(e){}},400); }dropZone.addEventListener('click',function(){fileInput.click();}); replaceImageBtn.addEventListener('click',function(){fileInput.click();}); removeImageBtn.addEventListener('click',removeImage); fileInput.addEventListener('change',function(e){ if(e.target.files&&e.target.files[0])loadImage(e.target.files[0]); }); dropZone.addEventListener('dragover',function(e){e.preventDefault();e.stopPropagation();dropZone.classList.add('dragover');}); dropZone.addEventListener('dragleave',function(e){e.preventDefault();dropZone.classList.remove('dragover');}); dropZone.addEventListener('drop',function(e){ e.preventDefault();e.stopPropagation(); dropZone.classList.remove('dragover'); if(e.dataTransfer.files&&e.dataTransfer.files[0])loadImage(e.dataTransfer.files[0]); }); themeToggle.addEventListener('click',function(){ wrapper.classList.toggle('dark'); themeToggle.textContent=wrapper.classList.contains('dark')?'Light Mode':'Dark Mode'; }); wrapper.querySelectorAll('.ac-tab').forEach(function(tab){ tab.addEventListener('click',function(){ wrapper.querySelectorAll('.ac-tab').forEach(function(t){t.classList.remove('active');}); wrapper.querySelectorAll('.ac-tab-content').forEach(function(c){c.classList.remove('active');}); tab.classList.add('active'); var target=wrapper.querySelector('#tab-'+tab.dataset.tab); if(target)target.classList.add('active'); }); }); bgModeSelect.addEventListener('change',function(){ customColorGroup.style.display=bgModeSelect.value==='custom'?'block':'none'; }); toleranceSlider.addEventListener('input',function(){toleranceVal.textContent=toleranceSlider.value;}); runAutoCropBtn.addEventListener('click',runAutoCrop); resetCropBtn.addEventListener('click',function(){ setDefaultCrop(); render(); pushHistory(); }); aspectRatioSelect.addEventListener('change',function(){ var val=aspectRatioSelect.value; if(val==='free')aspectRatio=null; else{ var parts=val.split(':'); aspectRatio=parseFloat(parts[0])/parseFloat(parts[1]); } applyAspectRatio(); render(); pushHistory(); }); rotateLeftBtn.addEventListener('click',function(){ imgState.rotation=(imgState.rotation-90+360)%360; setDefaultCrop(); render(); pushHistory(); }); rotateRightBtn.addEventListener('click',function(){ imgState.rotation=(imgState.rotation+90)%360; setDefaultCrop(); render(); pushHistory(); }); flipHBtn.addEventListener('click',function(){ imgState.flipH=!imgState.flipH; render(); pushHistory(); }); flipVBtn.addEventListener('click',function(){ imgState.flipV=!imgState.flipV; render(); pushHistory(); }); brightSlider.addEventListener('input',function(){ imgState.brightness=parseInt(brightSlider.value,10); brightVal.textContent=imgState.brightness; render(); }); brightSlider.addEventListener('change',function(){pushHistory();}); contrastSlider.addEventListener('input',function(){ imgState.contrast=parseInt(contrastSlider.value,10); contrastVal.textContent=imgState.contrast; render(); }); contrastSlider.addEventListener('change',function(){pushHistory();}); satSlider.addEventListener('input',function(){ imgState.saturation=parseInt(satSlider.value,10); satVal.textContent=imgState.saturation; render(); }); satSlider.addEventListener('change',function(){pushHistory();}); grayscaleCheck.addEventListener('change',function(){ imgState.grayscale=grayscaleCheck.checked; render(); pushHistory(); }); resetAdjBtn.addEventListener('click',function(){ imgState.brightness=0;imgState.contrast=0;imgState.saturation=0;imgState.grayscale=false; brightSlider.value=0;brightVal.textContent='0'; contrastSlider.value=0;contrastVal.textContent='0'; satSlider.value=0;satVal.textContent='0'; grayscaleCheck.checked=false; render(); pushHistory(); }); zoomInBtn.addEventListener('click',function(){ zoomLevel=Math.min(5,+(zoomLevel+0.15).toFixed(2)); zoomLevelDisplay.textContent=Math.round(zoomLevel*100)+'%'; render(); }); zoomOutBtn.addEventListener('click',function(){ zoomLevel=Math.max(0.2,+(zoomLevel-0.15).toFixed(2)); zoomLevelDisplay.textContent=Math.round(zoomLevel*100)+'%'; render(); }); zoomFitBtn.addEventListener('click',function(){ zoomLevel=1; zoomLevelDisplay.textContent='100%'; render(); }); undoBtn.addEventListener('click',function(){ if(historyIndex>0){historyIndex--;applyHistory(history[historyIndex]);updateHistoryButtons();} }); redoBtn.addEventListener('click',function(){ if(historyIndex=Math.abs(dy)){ nh=nw/aspectRatio; if(activeHandle.indexOf('t')!==-1)ny=startCrop.y+startCrop.h-nh; }else{ nw=nh*aspectRatio; if(activeHandle.indexOf('l')!==-1)nx=startCrop.x+startCrop.w-nw; } } } if(nw<8){nw=8;if(activeHandle.indexOf('l')!==-1)nx=startCrop.x+startCrop.w-8;} if(nh<8){nh=8;if(activeHandle.indexOf('t')!==-1)ny=startCrop.y+startCrop.h-8;} crop.x=nx;crop.y=ny;crop.w=nw;crop.h=nh; clampCrop(); } updateCropBoxUI(); updateStats(); } function onPointerUp(){ if(isInteracting){ isInteracting=false; interactionType=null; activeHandle=null; pushHistory(); } } cropBoxEl.addEventListener('mousedown',onPointerDown); cropBoxEl.addEventListener('touchstart',onPointerDown,{passive:false}); wrapper.querySelectorAll('.ac-handle').forEach(function(h){ h.addEventListener('mousedown',onPointerDown); h.addEventListener('touchstart',onPointerDown,{passive:false}); }); window.addEventListener('mousemove',onPointerMove); window.addEventListener('touchmove',onPointerMove,{passive:false}); window.addEventListener('mouseup',onPointerUp); window.addEventListener('touchend',onPointerUp); previewArea.addEventListener('wheel',function(e){ if(!originalImage)return; e.preventDefault(); var delta=e.deltaY>0?-0.08:0.08; zoomLevel=Math.max(0.2,Math.min(5,+(zoomLevel+delta).toFixed(2))); zoomLevelDisplay.textContent=Math.round(zoomLevel*100)+'%'; render(); },{passive:false}); var resizeTimer=null; window.addEventListener('resize',function(){ if(!originalImage)return; clearTimeout(resizeTimer); resizeTimer=setTimeout(function(){render();},120); }); document.addEventListener('keydown',function(e){ if(!originalImage)return; var tag=(e.target&&e.target.tagName||'').toLowerCase(); if(tag==='input'||tag==='textarea'||tag==='select'||(e.target&&e.target.isContentEditable))return; if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==='z'){ e.preventDefault(); if(e.shiftKey){if(historyIndex0){historyIndex--;applyHistory(history[historyIndex]);updateHistoryButtons();}} } }); enableControls(false); updateHistoryButtons(); })();