Oh MyUtils

Image Resizer - Resize Images by Dimensions, Percentage & Presets Online

Resize images to exact dimensions, scale by percentage, or use social media presets. Convert formats, control quality — 100% client-side, no upload to server.

Frequently Asked Questions

What is an image resizer and why do I need one?

An image resizer is a tool that changes the pixel dimensions of an image. Resizing is essential for optimizing images for web pages (reducing load times), meeting social media platform requirements (each platform has specific image dimensions), preparing images for email templates, and creating thumbnails. For example, Instagram requires 1080x1080 pixels for square feed posts, while YouTube thumbnails need to be 1280x720 pixels.

How do I use this image resizer tool?

1. Choose a resize mode: Dimensions (enter exact pixel values), Percentage (scale by a factor), or Presets (select a social media platform size). 2. Drag and drop your image onto the upload area (or click to browse files). 3. Adjust the resize settings: width/height, percentage, or select a preset. 4. Optionally change the output format (PNG, JPEG, WebP) and quality. 5. Click 'Resize All' to process images. 6. Download individual images or use 'Download All (ZIP)' for batch processing.

Is my image data safe? Are images uploaded to a server?

Your images are 100% safe and never leave your browser. All resizing is performed client-side using the HTML5 Canvas API. No image data is transmitted to any server, making this tool completely private. You can verify this by checking your browser's Network tab — no upload requests are made.

What is the difference between Fit, Fill, and Stretch modes?

Fit scales the image to fit entirely within the target dimensions while maintaining the original aspect ratio. The result may be smaller than the target in one dimension. Fill scales the image to completely cover the target dimensions while maintaining the aspect ratio, cropping any excess. Stretch forces the image to exactly match the target dimensions, which may distort the image if the aspect ratio differs. Fit is recommended for most use cases.

What image formats are supported?

This tool supports three common web image formats: PNG (lossless, supports transparency), JPEG (lossy compression with quality control, no transparency), and WebP (modern format with both lossy and lossless modes, supports transparency). You can also convert between formats during resize — for example, resize a PNG and save it as a WebP to reduce file size.

What are the correct image sizes for social media platforms?

The tool includes built-in presets for all major platforms: Twitter/X Post (1200x675), Instagram Feed (1080x1080), Instagram Story (1080x1920), Facebook Post (1200x630), YouTube Thumbnail (1280x720), LinkedIn Post (1200x627), and more. Select the 'Presets' mode and choose your target platform for one-click resizing to the correct dimensions.

Will resizing affect image quality?

Resizing can affect quality depending on the direction and format. Downscaling (making smaller) generally preserves quality well. Upscaling (making larger) uses bilinear interpolation, which may produce slightly blurry results — this is a limitation of the Canvas API. For lossy formats (JPEG, WebP), the quality slider controls the compression level. PNG output is always lossless. For best results when upscaling, use the highest quality setting.

What is the maximum file size and resolution supported?

This tool supports images up to 50MB per file and resolutions up to 16384 x 16384 pixels (the Canvas API limit in most browsers). For batch processing, you can resize up to 20 images simultaneously. On mobile devices, the maximum resolution may be lower due to memory constraints (approximately 16.7 megapixels on Safari iOS).

Code Examples

// Client-side image resizing using Canvas API
async function resizeImage(file, targetWidth, targetHeight, options = {}) {
  const { quality = 0.85, format = null, fitMode = 'fit' } = options;

  return new Promise((resolve, reject) => {
    const img = new Image();
    const url = URL.createObjectURL(file);

    img.onload = () => {
      URL.revokeObjectURL(url);
      const origW = img.naturalWidth;
      const origH = img.naturalHeight;
      let canvasW, canvasH, drawX = 0, drawY = 0, drawW, drawH;

      if (fitMode === 'fit') {
        const scale = Math.min(targetWidth / origW, targetHeight / origH);
        canvasW = Math.round(origW * scale);
        canvasH = Math.round(origH * scale);
        drawX = 0; drawY = 0; drawW = canvasW; drawH = canvasH;
      } else if (fitMode === 'fill') {
        const scale = Math.max(targetWidth / origW, targetHeight / origH);
        drawW = Math.round(origW * scale);
        drawH = Math.round(origH * scale);
        drawX = Math.round((targetWidth - drawW) / 2);
        drawY = Math.round((targetHeight - drawH) / 2);
        canvasW = targetWidth; canvasH = targetHeight;
      } else {
        canvasW = targetWidth; canvasH = targetHeight;
        drawW = targetWidth; drawH = targetHeight;
      }

      const canvas = document.createElement('canvas');
      canvas.width = canvasW; canvas.height = canvasH;
      const ctx = canvas.getContext('2d');

      const outputType = format || file.type || 'image/jpeg';
      if (outputType === 'image/jpeg') {
        ctx.fillStyle = '#ffffff';
        ctx.fillRect(0, 0, canvasW, canvasH);
      }

      ctx.drawImage(img, drawX, drawY, drawW, drawH);

      canvas.toBlob(
        (blob) => {
          if (!blob) { reject(new Error('Resize failed')); return; }
          resolve({
            blob, width: canvasW, height: canvasH,
            originalSize: file.size, resizedSize: blob.size,
          });
        },
        outputType,
        outputType === 'image/png' ? undefined : quality
      );
    };

    img.onerror = () => { URL.revokeObjectURL(url); reject(new Error('Failed to load')); };
    img.src = url;
  });
}

// Usage
const input = document.querySelector('input[type="file"]');
input.addEventListener('change', async (e) => {
  const file = e.target.files[0];
  const result = await resizeImage(file, 800, 600, { quality: 0.9, fitMode: 'fit' });
  console.log(`Resized: ${result.width}x${result.height}, ${result.resizedSize} bytes`);

  const url = URL.createObjectURL(result.blob);
  const a = document.createElement('a');
  a.href = url; a.download = 'resized.jpg'; a.click();
  URL.revokeObjectURL(url);
});

Related Tools