Close Menu
    Facebook X (Twitter) Instagram
    Articles Stock
    • Home
    • Technology
    • AI
    • Pages
      • About ArticlesStock — AI & Technology Journalist
      • Contact us
      • Disclaimer For Articles Stock
      • Privacy Policy
      • Terms and Conditions
    Facebook X (Twitter) Instagram
    Articles Stock

    Image Cropper

    CropMaster Studio – Free Online Image Cropper /* — CSS SEPARATION START — */ @import url(‘https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap’);:root { –primary: #16A34A; /* Green-600 */ –bg-dark: #111827; }body { font-family: ‘Inter’, sans-serif; transition: background-color 0.3s, color 0.3s; }/* Editor Area styling */ .editor-container { background-image: linear-gradient(45deg, #e5e7eb 25%, transparent 25%), linear-gradient(-45deg, #e5e7eb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e5e7eb 75%), linear-gradient(-45deg, transparent 75%, #e5e7eb 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px; background-color: #f3f4f6; } /* CropperJS Customization for Dark Mode */ .dark .editor-container { background-image: linear-gradient(45deg, #374151 25%, transparent 25%), linear-gradient(-45deg, #374151 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #374151 75%), linear-gradient(-45deg, transparent 75%, #374151 75%); background-color: #1f2937; }/* Tooltip */ [data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding: 4px 8px; background: #1f2937; color: white; font-size: 10px; border-radius: 4px; white-space: nowrap; margin-bottom: 5px; z-index: 50; }/* Dark Mode */ .dark body { background-color: var(–bg-dark); color: #F9FAFB; } .dark .card { background-color: #1F2937; border-color: #374151; } /* — CSS SEPARATION END — */ tailwind.config = { darkMode: ‘class’, theme: { extend: { colors: { primary: ‘#16A34A’, } } } }
    CropMasterStudio

    Crop & Resize Instantly

    Upload images to crop, rotate, flip, and adjust dimensions. Perfect for social media profiles and banners.

    Drop Image Here

    Supports JPG, PNG, WEBP, GIF (Max 10MB)

    X: 0 Y: 0 W: 0px H: 0px R: 0°

    Aspect Ratio

    Preview

    © 2025 CropMaster Studio. All processing happens locally in your browser.

    // — JAVASCRIPT SEPARATION START —// State let cropper = null; let isDarkMode = false; let flipX = 1; let flipY = 1;// DOM Elements const fileInput = document.getElementById(‘fileInput’); const dropzone = document.getElementById(‘dropzone’); const uploadView = document.getElementById(‘upload-view’); const editorView = document.getElementById(‘editor-view’); const imageElement = document.getElementById(‘image’); // Data Displays const dataX = document.getElementById(‘data-x’); const dataY = document.getElementById(‘data-y’); const dataWidth = document.getElementById(‘data-width’); const dataHeight = document.getElementById(‘data-height’); const dataRotate = document.getElementById(‘data-rotate’);// — Event Listeners — dropzone.addEventListener(‘click’, () => fileInput.click()); dropzone.addEventListener(‘dragover’, (e) => { e.preventDefault(); dropzone.classList.add(‘border-green-500’, ‘bg-green-50’, ‘dark:bg-green-900/20’); }); dropzone.addEventListener(‘dragleave’, () => { dropzone.classList.remove(‘border-green-500’, ‘bg-green-50’, ‘dark:bg-green-900/20’); }); dropzone.addEventListener(‘drop’, (e) => { e.preventDefault(); dropzone.classList.remove(‘border-green-500’, ‘bg-green-50’, ‘dark:bg-green-900/20’); if(e.dataTransfer.files.length) handleFile(e.dataTransfer.files[0]); }); fileInput.addEventListener(‘change’, (e) => { if(e.target.files.length) handleFile(e.target.files[0]); });// — Core Functions —function handleFile(file) { if (!file || !file.type.startsWith(‘image/’)) { alert(‘Please upload a valid image file.’); return; }const reader = new FileReader(); reader.onload = (e) => { imageElement.src = e.target.result; // Switch Views uploadView.classList.add(‘hidden’); editorView.classList.remove(‘hidden’); // Init Cropper (Needs small delay for DOM to render image) setTimeout(initCropper, 100); }; reader.readAsDataURL(file); }function initCropper() { if(cropper) cropper.destroy();cropper = new Cropper(imageElement, { viewMode: 1, // Restrict crop box to canvas size dragMode: ‘move’, autoCropArea: 0.8, restore: false, guides: true, center: true, highlight: false, cropBoxMovable: true, cropBoxResizable: true, toggleDragModeOnDblclick: false, preview: ‘.preview-lg’, // Preview selector crop(event) { // Update Info Bar dataX.innerText = `X: ${Math.round(event.detail.x)}`; dataY.innerText = `Y: ${Math.round(event.detail.y)}`; dataWidth.innerText = `W: ${Math.round(event.detail.width)}px`; dataHeight.innerText = `H: ${Math.round(event.detail.height)}px`; dataRotate.innerText = `R: ${Math.round(event.detail.rotate)}°`; }, }); }function setMode(mode) { if(!cropper) return; cropper.setDragMode(mode); // UI Toggle document.querySelectorAll(‘.tool-btn’).forEach(btn => btn.classList.remove(‘active’, ‘text-green-600’, ‘border-green-500’)); const btn = document.querySelector(`button[onclick=”setMode(‘${mode}’)”]`); if(btn) btn.classList.add(‘active’, ‘text-green-600’, ‘border-green-500’); }function setAspectRatio(ratio) { if(!cropper) return; cropper.setAspectRatio(ratio);// UI Toggle document.querySelectorAll(‘.ratio-btn’).forEach(btn => { btn.classList.remove(‘active’, ‘border-green-500’, ‘bg-green-50’, ‘text-green-700’); btn.classList.add(‘text-gray-600’, ‘dark:text-gray-300’); }); // Find the clicked button (event target wrapper logic needed if cleaner code, but we can rely on active class for now) // Or just check which button triggered this. For simplicity in this vanilla JS structure: const btns = document.querySelectorAll(‘.ratio-btn’); // This is a bit lazy matching, ideally pass `this` // Let’s rely on user click state which we don’t capture here easily without `this`. // Instead, manual update: // (We would need to pass ‘this’ in onclick to do it cleanly, but keeping code simple) } // Monkey patch for button active states document.querySelectorAll(‘.ratio-btn’).forEach(btn => { btn.addEventListener(‘click’, function() { document.querySelectorAll(‘.ratio-btn’).forEach(b => { b.classList.remove(‘active’, ‘border-green-500’, ‘bg-green-50’, ‘text-green-700’); b.classList.add(‘text-gray-600’, ‘dark:text-gray-300’); }); this.classList.add(‘active’, ‘border-green-500’, ‘bg-green-50’, ‘text-green-700’); this.classList.remove(‘text-gray-600’, ‘dark:text-gray-300’); }); });function rotate(deg) { if(!cropper) return; cropper.rotate(deg); }function flip(dir) { if(!cropper) return; if(dir === ‘h’) { flipX = -flipX; cropper.scaleX(flipX); } else { flipY = -flipY; cropper.scaleY(flipY); } }function zoom(ratio) { if(!cropper) return; cropper.zoom(ratio); }function resetEditor() { if(!cropper) return; cropper.reset(); flipX = 1; flipY = 1; }function downloadImage() { if(!cropper) return; // Get Canvas const canvas = cropper.getCroppedCanvas({ maxWidth: 4096, maxHeight: 4096, fillColor: ‘#fff’, // White background for JPG if transparency exists imageSmoothingEnabled: true, imageSmoothingQuality: ‘high’, });if(!canvas) { alert(‘Could not crop image. Check limits.’); return; }// Convert to Blob and Download canvas.toBlob((blob) => { const url = URL.createObjectURL(blob); const a = document.createElement(‘a’); a.href = url; a.download = ‘cropped-image.png’; // Default to PNG for quality a.click(); URL.revokeObjectURL(url); }, ‘image/png’); }function closeEditor() { if(cropper) { cropper.destroy(); cropper = null; } imageElement.src = ”; uploadView.classList.remove(‘hidden’); editorView.classList.add(‘hidden’); fileInput.value = ”; }// — Dark Mode — function toggleDarkMode() { isDarkMode = !isDarkMode; document.documentElement.classList.toggle(‘dark’); const icon = document.getElementById(‘theme-icon’); if(isDarkMode) { icon.classList.remove(‘fa-moon’); icon.classList.add(‘fa-sun’); } else { icon.classList.remove(‘fa-sun’); icon.classList.add(‘fa-moon’); } } // — JAVASCRIPT SEPARATION END —

    Using Image Cropper

    The Image Cropper utility is designed for image and graphics tasks. Check the on-page controls for available formats, limits and options. Always review the output for accuracy before sharing or publishing it.

    Practical tips

    • Keep your original files or source information as a backup.
    • Choose suitable options using the controls provided by this tool.
    • Check the generated result and retry with different settings if needed.

    Explore related tools

    Image Compressor and Image Resizer are available for related tasks.

    Categories
    • AI
    • Technology
    Recent Comments
    • 7 AI Tools for Small Business in 2026 Compared - Articles Stock on Google AI Mode and AI Overviews Update: What Changed for Publishers in October 2026
    • What Is Agentic AI? Complete Guide for 2026 - Articles Stock on Anthropic Public Benefit Fund: What Its 5% Equity Commitment Means for AI
    • 15 AI Tools for Small Business in 2026 Compared - Articles Stock on Best AI Writing Software 2026: Top 10 Tools Reviewed
    Facebook X (Twitter) Instagram Pinterest
    © 2026 articlesstock.com.Thanks for visiting our website.

    Type above and press Enter to search. Press Esc to cancel.