Skip to content

Integrations

PixelFiddler provides official SDK packages to help you integrate image transformations and optimizations into your applications. These packages handle URL generation, responsive images, and framework-specific optimizations.

PackageBest ForKey Features
@pixelfiddler/coreAny JavaScript/TypeScript projectURL building, responsive attributes, full control
@pixelfiddler/nextNext.js applicationsDrop-in Image replacement, automatic optimization
@pixelfiddler/reactReact applications (non-Next.js)<img> wrapper, responsive srcset, lazy loading

All SDKs accept a transformations object that lets you modify images on-the-fly. This section describes all available transformation options.

Control the dimensions and scaling behavior of your images.

OptionTypeDescription
widthnumberTarget width in pixels (1-4096)
heightnumberTarget height in pixels (1-4096)
dpr1 | 2 | 3 | 4Device pixel ratio for high-density displays
mode'FILL' | 'FIT' | 'PAD'Resize strategy (see below)
backgroundstringBackground color for PAD mode (hex, e.g., #ffffff)

Resize Modes:

  • FILL – Resize to fill the exact dimensions, cropping if necessary
  • FIT – Resize to fit within the dimensions, preserving aspect ratio
  • PAD – Resize to fit within dimensions and pad with background color
transformations: {
width: 800,
height: 600,
mode: 'FIT',
background: '#ffffff'
}

Control the output format and compression quality.

OptionTypeDescription
format'JPG' | 'PNG' | 'WEBP' | 'AVIF' | 'GIF'Output image format
qualitynumberCompression quality (1-100, higher is better)
stripMetadatabooleanRemove EXIF and other metadata from output
transformations: {
format: 'WEBP',
quality: 85,
stripMetadata: true
}

Apply visual effects to your images.

OptionTypeDescription
blurnumberGaussian blur intensity (0-100)
brightnessnumberBrightness adjustment (0-100, 50 is neutral)
contrastnumberContrast adjustment (0-100, 50 is neutral)
saturationnumberSaturation adjustment (0-100, 50 is neutral)
sharpennumberSharpen intensity (0-100)
noisenumberAdd noise/grain effect (0-100)
grayscalebooleanConvert image to grayscale
sepiabooleanApply sepia tone effect
rotate0 | 90 | 180 | 270Rotate image clockwise by degrees
transformations: {
blur: 20,
brightness: 60,
grayscale: true
}

Add borders and rounded corners to your images.

OptionTypeDescription
border.widthnumberBorder width in pixels
border.colorstringBorder color (hex, e.g., #000000)
border.radiusnumberCorner radius in pixels (1-2000)
transformations: {
border: {
width: 2,
color: '#000000',
radius: 8
}
}

Crop images with automatic or manual focus points.

Simple Crop with Auto Focus:

transformations: {
crop: {
type: 'SIMPLE',
width: 400,
height: 300,
focus: {
type: 'AUTO',
strategy: 'SMART' // 'CENTER' | 'SMART' | 'DETAIL'
},
afterResize: true // Apply crop after resize transformations
}
}

Simple Crop with Manual Position:

transformations: {
crop: {
type: 'SIMPLE',
width: 400,
height: 300,
focus: {
type: 'SPECIFIED',
position: { x: 50, y: 50 } // Percentage from top-left
}
}
}

Object Detection Crop:

Automatically detect and crop around faces or upper bodies.

transformations: {
crop: {
type: 'OBJECT',
objectType: 'FACE', // 'FACE' | 'UPPER_BODY'
width: 400,
height: 300
}
}

Add text overlays to your images.

OptionTypeDescription
text.textstringThe text content to display
text.colorstringText color (hex)
text.opacitynumberText opacity (0-100)
text.sizenumberText size as percentage of image (1-100)
text.fontstringFont family name
text.fontSizenumberFont size in pixels
text.positionPositionText position (see Position Values below)
text.backgroundstringBackground color behind text (hex)
text.backgroundOpacitynumberBackground opacity (0-100)
transformations: {
text: {
text: 'Copyright 2024',
color: '#ffffff',
opacity: 80,
fontSize: 24,
position: 'BOTTOM_RIGHT',
background: '#000000',
backgroundOpacity: 50
}
}

Add predefined watermarks from your PixelFiddler Dashboard.

OptionTypeDescription
watermark.namestringWatermark name (defined in Dashboard)
watermark.opacitynumberWatermark opacity (0-100)
watermark.sizenumberSize as percentage of image (1-100)
watermark.widthnumberExplicit width in pixels
watermark.heightnumberExplicit height in pixels
watermark.positionPositionWatermark position (see Position Values below)
transformations: {
watermark: {
name: 'logo',
opacity: 50,
size: 25,
position: 'BOTTOM_RIGHT'
}
}

Used for text.position and watermark.position:

'TOP_LEFT' 'TOP' 'TOP_RIGHT'
'LEFT' 'CENTER' 'RIGHT'
'BOTTOM_LEFT' 'BOTTOM' 'BOTTOM_RIGHT'
'AUTO'
OptionTypeDescription
originalbooleanReturn the original image without any transformations
aliasstringUse a predefined transformation alias from your Dashboard
// Return original image
transformations: { original: true }
// Use predefined alias
transformations: { alias: 'thumbnail' }

All SDKs provide full TypeScript support. Import types from any package:

import type {
TransformationOptions,
ResizeOptions,
FormatOptions,
EffectOptions,
CropOptions,
BorderOptions,
TextOptions,
WatermarkOptions,
PixelFiddlerConfig,
} from '@pixelfiddler/core';
// or from '@pixelfiddler/react'
// or from '@pixelfiddler/next'