Image Transformation

Encoding.com offers an image manipulation and optimization service that will provide a wide variety of image to image conversion options.

<?xml version="1.0"?>
<query>
    <userid><<id>></userid> <!-- required-->
    <userkey><<key>></userkey> <!-- required-->
    <action>[Action]</action> <!-- required-->
    <format>
        <!-- Format fields -->
        <output>image</output>
        <image_format>jpg</image_format> <!-- required-->
        <resize_method>resize</resize_method>
        <size>560x420</size>
        <keep_aspect_ratio>yes</keep_aspect_ratio>
        <quality>75</quality>
        <dpi>72</dpi>
        <sharpen_radius>1</sharpen_radius>
        <sharpen_sigma>0.5</sharpen_sigma>
        <remove_metadata>no</remove_metadata>
        <gravity>[northwest|north|northeast|west|center|east|southwest|south|southeast]</gravity>
        <shave>[9x12]</shave>
        <unsharp_radius>2.0</unsharp_radius>
        <unsharp_sigma>1.0</unsharp_sigma>
        <unsharp_gain>1.0</unsharp_gain>
        <unsharp_threshold>0.05</unsharp_threshold>
        <!-- Destination fields -->
        <destination>[DestFile]</destination>
    </format>
</query>
{
    "query": {
        "userid": "<<id>>",
        "userkey": "<<key>>",
        "action": "[Action]",
        "format": {
            "output": "image",
            "image_format": "jpg",
            "resize_method": "resize",
            "size": "560x420",
            "keep_aspect_ratio": "yes",
            "quality": "75",
            "dpi": "72",
            "sharpen_radius": "1",
            "sharpen_sigma": "0.5",
            "remove_metadata": "no",
            "gravity": "[northwest|north|northeast|west|center|east|southwest|south|southeast]",
            "shave": "[9x12]",
            "unsharp_radius": "2.0",
            "unsharp_sigma": "1.0",
            "unsharp_gain": "1.0",
            "unsharp_threshold": "0.05",
            "destination": "[DestFile]"
        }
    }
}

Parameter

Description

Allowed Values

Default Value

image_format

Specify the output format.

jpg, png, gif, tiff

jpg

size

Specify the size of the output.

WxH or Wx0 or 0xH or Wx or xH, where W and H are positive integers.

None

keep_aspect_ratio

Specify whether to keep width to height ratio of original picture.

yes, no

yes

resize_method

Specify how the original picture will be transformed to new size.

resize, crop, combine

resize

quality

Specify the level of JPEG quality.

jpg: 1-100
All: none

80

dpi

Specify the image DPI.

71-1200

72

sharpen_radius

Specify the output sharpen radius.

0-10

0

sharpen_sigma

Specify the amount of image sharpening. (recommendation is 0.5-1.0)

Float: 0, 0.2-10

0.5

remove_metadata

Specify whether to remove image metadata including EXIF.

yes, no

no

gravity

Sets the current gravity suggestion for various other options.

northwest, north, northeast, west, center, east, southwest, south, southeast

None

shave

Specify how many pixels to shave from the image edges.

WxH

None

unsharp_radius

Specify the radius of the gaussian.

In pixels, not counting the center pixel, should be larger than unsharp_sigma. Use a radius of 0 to have the method select a suitable radius.

None.

unsharp_sigma

Specify the standard deviation of the gaussian.

In pixels

1.0

unsharp_gain

Specify the fraction of the difference between the original and the blur image that is added back into the original.

Float

1.0

unsharp_threshold

Specify the threshold, as a fraction of QuantumRange, needed to apply the difference amount.

Float

0.05

❗️

For image_format parameter

<image_format /> is a required field.

🚧

For keep_aspect_ratio parameter

If either or is set to 0, <keep_aspect_ratio /> will be yes.