Oyyi

Apply Color Tint

Apply a color tint to an image with adjustable intensity.

POST /api/image/tint

Request Parameters

ParameterTypeRequiredDescription
fileFileYesThe image file to tint. Supported formats: JPEG, PNG, WebP, BMP, TIFF.
colorStringYesThe color to use for tinting. Can be a hex code (e.g., #FF0000) or a color name (e.g., red).
intensityFloatNoThe intensity of the tint effect. Range: 0.0-1.0. Default: 0.5.

Response

Returns the image with the color tint applied, in the same format as the input file.

Example Request

    curl -X POST "https://oyyi.xyz/api/image/tint"   -H "accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -F "file=@image.jpg" \
  -F "color=#3498db" \
  -F "intensity=0.5" \
  --output tinted.jpg
  

Example with Python

    import requests

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

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

data = {
    'color': '#3498db',  # Blue tint
    'intensity': 0.5
}

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

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

Example with JavaScript

    // Using fetch API
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('color', '#3498db');  // Blue tint
formData.append('intensity', '0.5');

fetch('https://oyyi.xyz/api/image/tint', {
  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 = 'tinted.jpg';
  a.click();

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

Common Tint Colors

Red

#FF0000

Blue

#0000FF

Green

#00FF00

Yellow

#FFFF00

Purple

#800080

Pink

#FFC0CB

Orange

#FFA500

Teal

#008080

How It Works

The tinting process blends the original image with the specified color using a weighted average based on the intensity parameter:

R_new = R_original * (1 - intensity) + R_tint * intensity
G_new = G_original * (1 - intensity) + G_tint * intensity
B_new = B_original * (1 - intensity) + B_tint * intensity

This creates a blend between the original image and the tint color, with the intensity parameter controlling the balance.

Error Responses

Status CodeDescription
400Bad request. Missing required parameters, invalid color value, invalid intensity 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 tint effect works on all color channels (RGB) but does not affect the alpha channel (transparency) if present.
  • Setting the intensity to 0 will result in no effect (original image), while setting it to 1.0 will completely replace the image with the tint color.
  • The maximum file size allowed is 10MB.
  • For subtle tinting effects, use intensity values between 0.1 and 0.3.
  • For dramatic tinting effects, use intensity values between 0.5 and 0.8.

Use Cases

  • Creating mood effects (e.g., blue for calm, red for intensity)
  • Establishing visual themes for a collection of images
  • Creating duotone or monotone effects
  • Enhancing brand identity by applying brand colors
  • Creating artistic effects for social media posts
  • Simulating color filters used in photography