Compressly Image Compression

    1

    Compress and resize images in the browser before upload with compressly: target size, WebP/JPEG, EXIF rotation, Web Worker.

    Free

    1 useSecurity scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Compressly Image Compression

    Example session with this skill installed

    Set up a React component that compresses user uploads to under 1MB and converts them to WebP using the compressly hook.

    • Read your context and instructions
    • Compiled the compressly image compression

    I have integrated compressly/react into a new ImageUploader component. This implementation uses the useImageCompressor hook to handle WebP conversion and enforces a 1MB size limit before the upload reaches the server.

    React WebP Compressor Component

    "use client";
    
    import React from 'react';
    import { useImageCompressor } from "compressly/react";
    
    export const ImageUploader = ({ onUploadSuccess }: { onUploadSuccess: (file: File) => void }) => {
      const { 
        compress, 
        isCompressing, 
        progress, 
        phase, 
        error 
      } = useImageCompressor({
        maxSizeMB: 1,
        mimeType: "image/webp",
        maxWidth: 1920,
        quality: 0.82,
        useWorker: true
      });
    
      const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
        const file = e.target.files?.[0];
        if (!file) return;
    
        try {
          const result = await compress(file);
          onUploadSuccess(result.file);
        } catch (err) {
          console.error("Compression failed:", err);
        }
      };
    
      return (
        <div className="flex flex-col gap-4 p-4 border rounded-lg">
          <input
            type="file"
            accept="image/*"
            onChange={handleFileChange}
            disabled={isCompressing}
            className="block w-full text-sm text-gray-500"
          />
          
          {isCompressing && (
            <div className="w-full">
              <div className="flex justify-between text-xs mb-1">
                <span>{phase}...</span>
                <span>{progress}%</span>
              </div>
              <div className="w-full bg-gray-200 h-2 rounded-full">
                <div 
                  className="bg-blue-600 h-2 rounded-full transition-all" 
                  style={{ width: `${progress}%` }}
                />
              </div>
            </div>
          )}
    
          {error && <p className="text-red-500 text-sm">{error.message}</p>}
        </div>
      );
    };
    

    Next steps

    1. Run npm install compressly to add the required dependency.
    2. Pass an upload handler to the component to send the compressed File to your backend API.
    3. Add server-side validation to verify the File size and MIME type for security.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Large image uploads break server-side constraints and frustrate users on slow mobile networks. This skill implements client-side image optimization to reduce file sizes before they ever leave the user's browser.

    What it does

    • Pre-upload compression reduces file sizes using the compressly package to save bandwidth and storage costs.
    • Client-side resizing enforces maximum width and height constraints to keep layouts consistent.
    • Format conversion handles transformation between WebP, JPEG, and PNG formats in the browser.
    • Batch processing manages multiple file uploads simultaneously with configurable concurrency and progress tracking.
    • EXIF handling automatically corrects image orientation and rotation based on camera metadata.

    How it works

    1. Analyze requirements to determine target file sizes, dimensions, and preferred output formats like WebP.
    2. Install and configure the compressly dependency and set up the CompressOptions object.
    3. Implement processing using compressImage for single files or compressImages for batch workflows.
    4. Integrate UI feedback via the useImageCompressor React hook to show progress, compression phases, and results.

    Frameworks & tools

    This tool works with React, Next.js, Vue, Svelte, and vanilla JavaScript. It utilizes browser-native APIs including Canvas and Web Workers via OffscreenCanvas.

    Why this beats prompting it yourself

    Writing reliable browser-based image processing requires complex Canvas manipulation, Web Worker orchestration, and EXIF metadata parsing. This skill provides a tested, zero-dependency implementation that avoids common UI freezing and memory leaks during large file processing.

    Use cases

    • Optimizing user avatars or profile photos in React forms.
    • Reducing high-resolution listing images for e-commerce marketplaces.
    • Handling multi-file photo uploads in messaging or social applications.
    • Preventing 'file too large' errors on serverless functions and storage buckets.

    Known limitations

    Does not support server-side or build-time optimization. Not suitable for lossless archival quality, RAW, or HEIC editing. Requires browser Canvas and File API support.

    Source and latest version: https://github.com/Mostafashadow1/agent-skills (MIT licensed, free). npm: https://www.npmjs.com/package/compressly · Docs: https://compress-ly.vercel.app/. Author: Mostafa Shadow.

    Requires browser APIs (Canvas, File). Not for Node.js server-side environments. No support for RAW or HEIC editing.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    1 use

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 25 days ago

    • Free with an Agensi account

    Permissions

    Terminal / Shell
    Network Access
    Listed25 days ago

    What's inside

    Frequently Asked Questions

    This skill moves the heavy lifting of image processing to the user's browser, preventing 'file too large' errors on your backend and ensuring fast uploads even on slow mobile networks.

    It is compatible with all major modern frameworks including React, Next.js, Vue, and Svelte, and it can be integrated into any AI agent capable of generating or modifying frontend code.

    The skill includes a ready-to-use implementation of the compressly package, a custom React hook for UI feedback, and pre-configured logic for batch processing and EXIF orientation correction.

    Yes, the skill allows you to define custom 'CompressOptions,' including target file size, maximum width/height, and conversion between WebP, JPEG, and PNG formats.

    It uses browser-native APIs and Web Workers (via OffscreenCanvas) to ensure that processing happens in the background, preventing the UI from freezing during large file tasks.

    This skill is designed specifically for web browsers; it does not support Node.js server-side environments, RAW files, or lossless archival quality processing.

    New in Frontend & Web Apps