Oyyi

Emboss Effect

Apply an emboss effect to images, creating a 3D relief-like appearance.

POST /api/image/emboss

Request Parameters

ParameterTypeRequiredDescription
fileFileYesThe image file to process. Supported formats: JPEG, PNG, WebP, BMP, TIFF.

Response

Returns the embossed image in the same format as the input file.

Example Request

    // example.sh
curl -X POST "https://oyyi.xyz/api/image/emboss"   -H "accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@image.jpg" \
  --output embossed.jpg
  

Example with Python

    // emboss.py
import requests

url = "https://oyyi.xyz/api/image/emboss"

files = {
    'file': open('image.jpg', 'rb')
}

data = {}

response = requests.post(url, files=files, data=data)

# Save the embossed image
with open('embossed.jpg', 'wb') as f:
    f.write(response.content)
  

Example with JavaScript

    // emboss.js
// Using fetch API
const formData = new FormData();
formData.append('file', fileInput.files[0]);

fetch('https://oyyi.xyz/api/image/emboss', {
  method: 'POST',
  body: formData
})
.then(response => response.blob())
.then(blob => {
  // Create a URL for the blob
  const url = URL.createObjectURL(blob);

  // Create a link to download the image
  const a = document.createElement('a');
  a.href = url;
  a.download = 'embossed.jpg';
  a.click();

  // Clean up by revoking the URL
  URL.revokeObjectURL(url);
})
.catch(error => console.error('Error:', error));
  

Direction Values

0° or 360°

Light from the right

90°

Light from the bottom

180°

Light from the left

270°

Light from the top

45°

Light from bottom-right

135°

Light from bottom-left (default)

How It Works

The emboss effect creates a 3D relief-like appearance by highlighting edges in a directional way:

  1. Convolution: The algorithm applies a directional convolution kernel to the image.
  2. Edge Enhancement: This kernel enhances edges in a specific direction while suppressing others.
  3. Offset: The result is offset to create a neutral gray background for the embossed edges.
  4. Color Preservation (Optional): If grayscale is set to false, the original colors are partially preserved and blended with the emboss effect.

The direction parameter determines the angle of the convolution kernel, which affects the perceived direction of the light source.

Strength Examples

Low Strength (0.5-1.0)

Subtle emboss effect, gentle relief

Medium Strength (1.1-2.5)

Moderate emboss effect, good for most uses

High Strength (2.6-5.0)

Strong emboss effect, pronounced relief

Error Responses

Status CodeDescription
400Bad request. Missing required parameters, invalid strength value, invalid direction value, or invalid file format.
413Payload too large. The file size exceeds the maximum allowed limit.
500Internal server error. Something went wrong on the server.

Notes

  • The emboss effect works best on images with clear edges and distinct features.
  • Setting grayscale to true creates a more traditional emboss look, similar to embossed metal or paper.
  • The default direction (135°) simulates light coming from the top-left, which is a common convention in design.
  • The maximum file size allowed is 10MB.
  • This operation preserves the alpha channel (transparency) if present in the original image.
  • For the best results, experiment with different strength and direction values to find the optimal settings for your specific image.

Use Cases

  • Creating textured or relief-like effects for design projects
  • Enhancing logos or text with a 3D appearance
  • Simulating engraved or embossed materials
  • Creating artistic effects for digital art
  • Highlighting structural details in architectural or product photography
  • Creating custom textures for graphic design