A modern React web application for content-aware image resizing using the seam carving algorithm. This application allows users to resize images while preserving important visual content by intelligently removing low-energy seams.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ React Frontend │ │ WebAssembly │ │ Image I/O │
│ (App.jsx) │◄───►│ (seamcarving) │◄───►│ (c_img) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
-
Frontend Layer
- React-based UI for image upload and processing
- Tailwind CSS for styling
- Client-side image processing using WebAssembly
-
Processing Layer
- WebAssembly module for seam carving algorithm
- Optimized C implementation for performance
- Energy calculation and seam finding
-
Image Layer
- C-based image processing utilities
- Handles image data conversion and manipulation
- Provides interface between JavaScript and C
- Frontend Framework: React with Vite
- Styling: Tailwind CSS
- Image Processing: WebAssembly (C)
- Build Tools: Vite, Emscripten
- Deployment: Vercel
-
Image Upload
- Support for various image formats
- Client-side image validation
- Preview of original image
-
Seam Carving
- Content-aware image resizing
- Percentage-based width reduction
- Real-time seam calculation
- Energy-based seam selection
-
Image Processing
- WebAssembly-powered processing
- No server-side processing required
- Efficient memory management
-
User Interface
- Intuitive controls for reduction percentage
- Real-time preview of changes
- Download processed images
- Responsive design
seamcarving-wasm-app/
├── src/ # React source code
│ ├── App.jsx # Main application component
│ ├── loadWasm.js # WebAssembly loading utility
│ └── utils/ # Utility functions
│ ├── seamUtils.js # Seam calculation utilities
│ └── wasmUtils.js # WebAssembly interaction utilities
├── wasm/ # WebAssembly source files
│ ├── seamcarving.c # Core seam carving algorithm
│ ├── c_img.c # Image processing utilities
│ └── build_wasm.sh # WebAssembly build script
- Node.js (v14 or higher)
- npm (v6 or higher)
- Emscripten (for WebAssembly compilation)
-
Clone the repository:
git clone <repository-url> cd seamcarving-wasm-app
-
Install dependencies:
npm install
-
Compile WebAssembly:
cd wasm chmod +x build_wasm.sh ./build_wasm.sh -
Start development server:
npm run dev
-
Open http://localhost:5173 in your browser
src/App.jsx: Main application component handling UI and user interactionssrc/loadWasm.js: Manages WebAssembly module loading and initializationsrc/utils/seamUtils.js: Contains utilities for seam calculation and validationsrc/utils/wasmUtils.js: Handles WebAssembly module interactionwasm/seamcarving.c: Core seam carving algorithm implementationwasm/c_img.c: Image processing utilities
- UI Changes: Modify
src/App.jsx - Algorithm Updates: Edit
wasm/seamcarving.c - Image Processing: Update
wasm/c_img.c - Build Process: Modify
wasm/build_wasm.sh
The application is configured for deployment on Vercel. See the deployment section in the original README for detailed instructions.
MIT License