# JCJC Image Processing API v4 for LLMs

> JCJC Image Processing API provides 17 powerful, stable, and easy-to-use endpoints for cropping, resizing, watermarking, mockup generation, and more.

## Authentication (🛡️ 接口鉴权)
All endpoints require a Bearer Token in the HTTP Header.
- Header Format: `Authorization: Bearer <your_api_key>`
- Apply for a token: https://www.cuobiezi.net/user/api_keys/list

## Base URL
Production: `https://www.cuobiezi.net/api/v4/image-tools`

## Request Format
All endpoints use the `POST` method and require `multipart/form-data` to upload the image file and its parameters.
Except for `/metadata` which returns JSON, all endpoints return the processed binary image stream.

## Endpoints

### 1. Mockup (`/mockup`)
Generates beautiful mockups with background, shadow, and watermarks.
- `file` (File, Required): The input image.
- `background_color` (String): e.g., `#FF6B6B`.
- `watermark_text` (String): Watermark text.
- `watermark_font_size` (Int)
- `watermark_color` (String)
- `watermark_margin_left` (Int)
- `watermark_margin_bottom` (Int)
- `watermark_bg_enabled` (Bool)
- `watermark_bg_shape` (String)
- `watermark_bg_color` (String)
- `watermark_render_method` (String)
- `watermark_bold` (Bool)
- `watermark_bg_padding_h` (Int)
- `watermark_bg_padding_v` (Int)
- `watermark_bg_radius` (Int)
- `shadow_offset_x` (Int)
- `shadow_offset_y` (Int)
- `shadow_blur` (Int)
- `shadow_color` (String)
- `shadow_enabled` (Bool)
- `shadow_opacity` (Float)
- `corner_radius` (Int)
- `scale_factor` (Float)

### 2. Resize (`/resize`)
Resizes image to specific width/height while maintaining aspect ratio.
- `file` (File, Required)
- `width` (Int)
- `height` (Int)

### 3. Enlarge (`/enlarge`)
Lossless enlargement.
- `file` (File, Required)
- `width` (Int)
- `height` (Int)

### 4. Crop (`/crop`)
Crops image to dimensions.
- `file` (File, Required)
- `width` (Int)
- `height` (Int)
- `gravity` (String): centre, north, south, east, west.
- `smart` (Bool): Smart cropping.

### 5. Rotate (`/rotate`)
Rotates the image.
- `file` (File, Required)
- `angle` (Int): 90, 180, 270.

### 6. Flip (`/flip`)
Vertical flip (mirror).
- `file` (File, Required)

### 7. Flop (`/flop`)
Horizontal flip.
- `file` (File, Required)

### 8. Zoom (`/zoom`)
Zooms by a factor.
- `file` (File, Required)
- `factor` (Float): e.g., 2.0 or 0.5.

### 9. Thumbnail (`/thumbnail`)
Generates thumbnail.
- `file` (File, Required)
- `width` (Int, Required)
- `height` (Int, Optional)

### 10. Extract (`/extract`)
Extracts region by coordinates.
- `file` (File, Required)
- `top` (Int)
- `left` (Int)
- `width` (Int)
- `height` (Int)

### 11. Watermark (`/watermark`)
Adds text watermark.
- `file` (File, Required)
- `text` (String)
- `opacity` (Float): e.g., 0.6.
- `margin` (Int)
- `font` (String): e.g., `sans bold 24`.
- `position` (String)

### 12. Blur (`/blur`)
Gaussian blur.
- `file` (File, Required)
- `sigma` (Float): Blur intensity, e.g., 10.0.

### 13. Colorspace (`/colorspace`)
Converts colorspace.
- `file` (File, Required)
- `space` (String): `bw`, `greyscale`.

### 14. Convert (`/convert`)
Converts format.
- `file` (File, Required)
- `format` (String): `png`, `jpeg`, `webp`, `avif`.
- `quality` (Int): 1-100.

### 15. Metadata (`/metadata`)
Reads EXIF metadata. Returns JSON instead of image.
- `file` (File, Required)

### 16. Trim (`/trim`)
Trims edges.
- `file` (File, Required)
- `threshold` (Int): Tolerance threshold, e.g., 10.

### 17. Process (`/process`)
Batch process via processing chain.
- `file` (File, Required)
- `*` (Dynamic): Accepts combinations of `format`, `width`, `rotate`, `blur`, etc.
