image-crop-rotate
Scannednpx machina-cli add skill instavm/coderunner/image-crop-rotate --openclawImage Crop and Rotate
Overview
This skill provides functionality to crop images to 50% of their original size from the center and rotate them 90 degrees clockwise. It uses a reliable Python script with PIL/Pillow for consistent, high-quality image processing.
When to Use This Skill
Use this skill when the user requests:
- Cropping an image to 50% from the center
- Rotating an image 90 degrees (clockwise)
- Both cropping and rotating an image
- Image processing tasks that combine center cropping with rotation
How to Use This Skill
Overview
The skill provides a single script that performs both operations: cropping to 50% from center and rotating 90 degrees clockwise.
Process
-
Identify the input image: Locate the user's uploaded image file in
/mnt/user-data/uploads/ -
Execute the script: Run the
crop_and_rotate.pyscript with input and output paths:python scripts/crop_and_rotate.py <input_path> <output_path> -
Provide the result: Move the processed image to
/mnt/user-data/outputs/and share it with the user
Script Details
scripts/crop_and_rotate.py
This script performs two operations in sequence:
- Crops the image to 50% of its original size, centered
- Rotates the cropped image 90 degrees clockwise
Usage:
python scripts/crop_and_rotate.py input.jpg output.jpg
Arguments:
- First argument: Path to input image
- Second argument: Path to save processed image
Supported formats: Any format supported by PIL/Pillow (JPEG, PNG, GIF, BMP, TIFF, etc.)
Output: The script prints processing details including original size, cropped size, and final size
Example Workflow
# Process an uploaded image
python /mnt/user-data/skills/image-crop-rotate/scripts/crop_and_rotate.py \
/mnt/user-data/uploads/photo.jpg \
/mnt/user-data/outputs/photo_processed.jpg
The script will:
- Open the input image
- Crop it to 50% from the center (e.g., 1000x800 → 500x400)
- Rotate the cropped image 90° clockwise (e.g., 500x400 → 400x500)
- Save the result to the output path
Source
git clone https://github.com/instavm/coderunner/blob/main/skills/public/image-crop-rotate/SKILL.mdView on GitHub Overview
This skill crops an image to 50% of its original size from the center and then rotates it 90 degrees clockwise using PIL/Pillow. It provides a reliable, single-script workflow for centered cropping and rotation, ideal for preparing profile photos, thumbnails, or banners.
How This Skill Works
A single Python script (crop_and_rotate.py) opens the input image, crops it to 50% from the center, then rotates the result 90° clockwise, and saves the output. It reads inputs from /mnt/user-data/uploads/ and writes results to /mnt/user-data/outputs/, printing processing details such as original, cropped, and final sizes.
When to Use It
- User requests cropping an image to 50% from the center
- User requests rotating an image 90 degrees clockwise
- User needs both center cropping and rotation in one operation
- Processing an uploaded image and saving the result for sharing
- Ensuring output is in a PIL/Pillow-supported format (e.g., JPEG, PNG, GIF, BMP, TIFF)
Quick Start
- Step 1: Ensure your input image is in /mnt/user-data/uploads/
- Step 2: Run: python scripts/crop_and_rotate.py <input_path> <output_path>
- Step 3: Move the result to /mnt/user-data/outputs/ and share with the user
Best Practices
- Ensure the input file exists in /mnt/user-data/uploads/ before running
- Verify the script path and that python has permission to read/write in the input/output folders
- Test with a sample image to confirm crop size and orientation are correct
- Check that the output format matches the desired delivery format (JPEG/PNG, etc.)
- Always save the result to /mnt/user-data/outputs/ and share from there
Example Use Cases
- Profile photo: 1000x800 image -> center crop to 500x400, then rotate to 400x500 for a vertical portrait
- Product image: 1200x900 -> crop 600x450 -> rotate to 450x600 for catalog thumbnails
- Logo asset: 800x600 -> crop 400x300 -> rotate to 300x400 for square-friendly branding
- Social post image: single-step crop+rotate to fit platform aspect while preserving the subject center
- Quick preview: run on a test image in uploads to confirm output in outputs before final usage