Documentation

static.respublika-shin.ru is an image cache & resize service. Our servers resize your image, cache it worldwide, and display it. Feedback? GitHub!

Requesting an image:

Quick reference

Name GET Description  
Width w Sets the width of the image, in pixels. info
Height h Sets the height of the image, in pixels. info
Device pixel ratio dpr Sets the output density of the image. info
Transformation t Sets how the image is fitted to its target dimensions. info
Border border Sets border around image (int). info
Crop crop Crops the image to specific dimensions. info
Crop alignment a Sets how the crop is aligned. info
Masking mask Sets the mask type from a predefined list. info
Mask trim mtrim Removes the remaining whitespace from the mask. info
Mask background mbg Sets the background color of the mask. info
Orientation or Rotates the image. info
Brightness bri Adjusts the image brightness. info
Contrast con Adjusts the image contrast. info
Gamma gam Adjusts the image gamma. info
Sharpen sharp Sharpen the image. info
Trim trim Trim "boring" pixels from all edges. info
Blur blur Adds a blur effect to the image. info
Filter filt Applies a filter effect to the image. info
Background bg Sets the background color of the image. info
Quality q Defines the quality of the image. info
Output output Encodes the image to a specific format. info
Interlace / progressive il Adds interlacing to GIF and PNG. JPEG's become progressive. info
Base64 (data URL) encoding Encodes the image to be used directly in the src= of the <img>-tag. info
Default image errorredirect Redirects to a default image when there is a problem loading an image. info
Page page To load a given page. info
Filename filename To specify the filename. info

Size

Controls how the image needs to be resized. You can use both &w= and &h= parameters or only one of them: the other dimension is automatically updated.

Width

&w=

Sets the width of the image, in pixels.

<img src="//static.respublika-shin.ru/image.jpg?&w=300">

Height

&h=

Sets the height of the image, in pixels.

<img src="//static.respublika-shin.ru/image.jpg?&h=300">

Device pixel ratio

&dpr=New!

The device pixel ratio is used to easily convert between CSS pixels and device pixels. This makes it possible to display images at the correct pixel density on a variety of devices such as Apple devices with Retina Displays and Android devices. You must specify either a width, a height, or both for this parameter to work. Use values between 1 and 8.

More info: Issue #115 - DPI support.

<img src="//static.respublika-shin.ru/image.jpg?&h=144&dpr=2">

Transformation

Controls how the image is fitted to its target dimensions. Below are a couple of examples.

Fit

&t=fit

Default. Resizes the image to fit within the width and height boundaries without cropping, distorting or altering the aspect ratio. Will not oversample the image if the requested size is larger than that of the original.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=fit">

Fitup

&t=fitup

Resizes the image to fit within the width and height boundaries without cropping, distorting or altering the aspect ratio. Will increase the size of the image if it is smaller than the output size.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=fitup">

Square

&t=square

Resizes the image to fill the width and height boundaries and crops any excess image data. The resulting image will match the width and height constraints without distorting the image. Will increase the size of the image if it is smaller than the output size.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=square">

Squaredown

&t=squaredown

Resizes the image to fill the width and height boundaries and crops any excess image data. The resulting image will match the width and height constraints without distorting the image. Will not oversample the image if the requested size is larger than that of the original.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=squaredown">

Absolute

&t=absolute

Stretches the image to fit the constraining dimensions exactly. The resulting image will fill the dimensions, and will not maintain the aspect ratio of the input image.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=absolute">

Letterbox

&t=letterbox

Resizes the image to fit within the width and height boundaries without cropping or distorting the image, and the remaining space is filled with the background color. The resulting image will match the constraining dimensions.

More info: Issue #80 - letterbox images that need to fit.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=letterbox&bg=black">

Border

Controls image border. Below are a couple of examples.

Border

&border=(int)

Will add border around image. For example yandex marketplace and google addwords use your images as-is, and sometimes do not add border around image from your feed.xml for example:

Border fix this issue:

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=letterbox&bg=black">

Crop

Controls how the image is aligned.

Crop position

&a=

You can set where the image is cropped by adding a crop position. Only works when t=square. Accepts top, left, center, right or bottom. Default is center. For more information, please see the suggestion on our GitHub issue tracker: Issue #24 - Aligning.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=square&a=top">

Crop focal point

&a=crop-x%-y%

In addition to the crop position, you can be more specific about the exact crop position using a focal point. Only works when t=square. This is defined using two offset percentages: crop-x%-y%.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=square&a=crop-0-20">

Smart crop

&a=entropy or &a=attentionNew!

Crops the image down to specific dimensions by removing boring parts. Only works when t=square. More info: Issue #90 - Add support for smart crop.

Accepts:

  • entropy: focus on the region with the highest Shannon entropy.
  • attention: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=square&a=attention">

Manual crop

&crop=

Crops the image to specific dimensions after any other resize operations. Required format: width,height,x,y.

<img src="//static.respublika-shin.ru/image.jpg?&crop=500,500,300,400">

Masking

Controls the visible and non-visible area of the image.

Note

Previously the &mask and &mtrim parameter were named as &shape and &strim. In July 2018 it was renamed to make room for new mask features.

Mask type

&mask=

Sets the mask type from a predefined list of shapes. More info: Issue #49 - Add circle effect to photos.

Accepts:

  • circle
  • ellipse
  • triangle
  • triangle-180: Triangle tilted upside down
  • pentagon
  • pentagon-180: Pentagon tilted upside down
  • hexagon
  • square: Square tilted 45 degrees
  • star: 5-point star
  • heart
<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=300&t=square&mask=circle">

Mask trim

&mtrim

Removes the remaining whitespace from the mask.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&h=900&t=square&a=crop-22-0&mask=circle&mtrim">

Mask background

&mbg=New!

Sets the background color of the mask. See here for the supported color formats.

<img src="//static.respublika-shin.ru/PNG_transparency_demonstration.png?&w=400&bg=black&mask=heart&mbg=red">

Adjustments

Orientation

&or=

Rotates the image. Accepts auto or if an angle is specified, it is converted to a valid 90/180/270 degree rotation. For example, -450 will produce a 270 degree rotation. Default is auto. The auto option uses Exif data to automatically orient images correctly.

<img src="//static.respublika-shin.ru/image.jpg?&h=300&or=90">

Brightness

&bri=

Adjusts the image brightness. Use values between -100 and +100, where 0 represents no change.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&bri=-25">

Contrast

&con=

Adjusts the image contrast. Use values between -100 and +100, where 0 represents no change.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&con=25">

Gamma

&gam=

Adjusts the image gamma. Use values between 1 and 3. The default value is 2.2, a suitable approximation for sRGB images.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&gam=1.2">

Sharpen

&sharp=

Sharpen the image. Required format: f,j,r

Arguments:

  • Flat f - Sharpening to apply to flat areas. (Default: 1.0)
  • Jagged j - Sharpening to apply to jagged areas. (Default: 2.0)
  • Radius r - Sharpening mask to apply in pixels, but comes at a performance cost. (optional)
<img src="//static.respublika-shin.ru/image.jpg?&w=300&sharp=5,5,3">

Trim

&trim=

Trim "boring" pixels from all edges that contain values within a similarity of the top-left pixel. Trimming occurs before any resize operation. Use values between 1 and 254 to define a tolerance level to trim away similar color values. You also can specify just &trim, which defaults to a tolerance level of 10.

More info: Issue #39 - able to remove black/white whitespace.

<img src="//static.respublika-shin.ru/PNG_transparency_demonstration.png?&w=300&trim=10">

Background

&bg=

Sets the background color of the image. Supports a variety of color formats. In addition to the 140 color names supported by all modern browsers (listed here), it also accepts hexadecimal RGB and RBG alpha formats. More info: Issue #81 - Background setting.

Hexadecimal

  • 3 digit RGB: CCC
  • 4 digit ARGB (alpha): 5CCC
  • 6 digit RGB: CCCCCC
  • 8 digit ARGB (alpha): 55CCCCCC
<img src="//static.respublika-shin.ru/PNG_transparency_demonstration.png?&w=400&bg=black">

Effects

Blur

&blur=

Adds a blur effect to the image. Use values between 0 and 100.

More info: Issue #69 - Allow blur transformation (with radius parameter).

<img src="//static.respublika-shin.ru/image.jpg?&w=300&blur=5">

Filter

&filt=

Applies a filter effect to the image. Accepts greyscale, sepia or negate.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&filt=greyscale">

Encoding

Quality

&q=

Defines the quality of the image. Use values between 0 and 100. Defaults to 85. Only relevant if the format is set to jpg.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&q=20">

Output

&output=

Encodes the image to a specific format. Accepts jpg, png, gif, tiff or webp. If none is given, it will honor the origin image format.

More info: Issue #62 - Format conversion.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&output=webp">

Interlace / progressive

&il

Adds interlacing to GIF and PNG. JPEG's become progressive.

More info: Issue #50 - Add parameter to use progressive JPEGs.

<img src="//static.respublika-shin.ru/image.jpg?&w=300&il">

Base64 (data URL)

&encoding=base64

Encodes the image to be used directly in the src= of the <img>-tag. Use this link to see the output result.

More info: Issue #59 - Return image base64 encoded.

//static.respublika-shin.ru/image.jpg?&crop=100,100,720,530&encoding=base64

Miscellaneous

Default image

&errorredirect=New!

If there is a problem loading an image, then a error is shown. However, there might be a need where instead of giving a broken image to the user, you want a default image to be delivered.

More info: Issue #37 - Return default image if the image's URL not found.

The URL must not include a errorredirect querystring (if it does, it will be ignored).

<img src="//static.respublika-shin.ru/example.org/noimage.jpg&errorredirect=ssl:static.respublika-shin.ru%2F%3Furl%3Dimage.jpg%26w%3D300">

Page

&page=New!

To load a given page (for an PDF, TIFF and multi-size ICO file). The value is numbered from zero.

Filename

&filename=New!

To specify the filename returned in the Content-Disposition header. The filename must only contain alphanumeric characters.

More info: Issue #122 - Specify filename.