API Endpoint Access URL
https://api.pixlab.io/resizegif
Get Your API Key & Try RESIZEGIF Now ↗Description
Scales a GIF file to the desired dimensions. Use resize for other media format. This endpoint is available starting from the Prod Plan and up.
HTTP Methods
GET, POST
HTTP Parameters
Required
Fields | Type | Description |
---|---|---|
img |
URL | Input GIF URL. If you want to upload your GIF directly from your app, call store before invoking this endpoint. |
width |
Integer | Desired new Width. If omitted, the height value will be used for proportional scaling. |
height |
Integer | Desired new Height. If omitted, the width value will be used for proportional scaling. |
key |
String | Your PixLab API Key ↗. Alternatively, embed your key in the WWW-Authenticate: HTTP header to omit this parameter. |
Optional
Fields | Type | Description |
---|---|---|
blob |
Boolean | Returns the raw GIF binary data when set to true . Default behavior returns a JSON response with the output URL. |
POST Request Body
Use when making POST requests instead of GET.
Allowed Content-Types:
multipart/form-data
application/json
Use multipart/form-data
for direct file uploads (see examples). For JSON, ensure the media file is already hosted elsewhere. Call store to upload files before processing.
HTTP Response
Fields | Type | Description |
---|---|---|
status |
Integer | Status code 200 indicates success, any other code indicates failure. |
link |
URL | Link to the gif output which is usually stored on the pixlab.xyz storage server unless you set your own S3 keys (refer to your dashboard ↗ on how to do that). |
id |
String | Unique media ID. |
error |
String | Error message if status != 200. |
The API returns application/json
if the optional blob parameter is not set.
This endpoint returns a JSON Object after each call only if the optional blob parameter is omitted. When blob is set, the GIF binary data is returned directly. The response JSON contains the following fields:
Code Samples
import requests
def resize_gif(image_url: str, width: int, height: int, api_key: str) -> str:
"""Resize a GIF using the PixLab API and return the processed image URL."""
params = {
'img': image_url,
'key': api_key,
'width': width,
'height': height,
}
try:
response = requests.get(
'https://api.pixlab.io/resizegif',
params=params,
timeout=10
)
response.raise_for_status()
data = response.json()
if data['status'] != 200:
raise ValueError(data.get('error', 'Unknown error occurred'))
return data['link']
except requests.exceptions.RequestException as e:
raise ConnectionError(f"API request failed: {e}") from e
if __name__ == "__main__":
try:
gif_url = resize_gif(
image_url='http://cloud.addictivetips.com/wp-content/uploads/2009/testing.gif',
width=256,
height=256,
api_key='PIXLAB_API_KEY'
)
print(f"GIF location: {gif_url}")
except Exception as e:
print(f"Error: {e}")
fetch('https://api.pixlab.io/resizegif?img=http://cloud.addictivetips.com/wp-content/uploads/2009/testing.gif&key=PIXLAB_API_KEY&width=256&height=256')
.then(response => response.json())
.then(data => {
if (data.status !== 200) {
console.log(data.error);
} else {
console.log("GIF location: " + data.link);
}
})
.catch(error => console.error('Error:', error));
<?php
$params = [
'img' => 'http://cloud.addictivetips.com/wp-content/uploads/2009/testing.gif',
'key' => 'PIXLAB_API_KEY',
'width' => 256,
'height' => 256
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.pixlab.io/resizegif?' . http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
$reply = json_decode($response, true);
if ($reply['status'] != 200) {
echo $reply['error'];
} else {
echo "GIF location: " . $reply['link'];
}
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('https://api.pixlab.io/resizegif')
params = {
'img' => 'http://cloud.addictivetips.com/wp-content/uploads/2009/testing.gif',
'key' => 'PIXLAB_API_KEY',
'width' => 256,
'height' => 256
}
uri.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(uri)
reply = JSON.parse(response.body)
if reply['status'] != 200
puts reply['error']
else
puts "GIF location: #{reply['link']}"
end
Similar API Endpoints
makegif, crop, resize, cropgif, gifcomposite, meme, screencapture, drawtext, scale, nsfw