five

Image to GIF Converter API

收藏
RapidAPI2025-05-23 更新2025-05-24 收录
下载链接:
https://rapidapi.com/contactimgram/api/image-to-gif-converter-api
下载链接
链接失效反馈
官方服务:
资源简介:
A powerful API that converts multiple images into an animated GIF with customizable frame duration. Perfect for creating animated sequences, slideshows, or simple animations from static images.
创建时间:
2025-05-23
原始信息汇总

Image to GIF Converter API 数据集概述

基本信息

  • API名称: Image to GIF Converter API
  • 类别: Video, Images
  • 流行度: 8.4
  • 服务等级: 100%
  • 延迟: 1002ms
  • 测试状态: N/A
  • 订阅计划:
    • BASIC: $0.00 / mo
    • PRO: $1.00 / mo
    • ULTRA: $2.00 / mo
    • MEGA: $5.00 / mo

功能概述

  • 将多张图片转换为单个动画GIF
  • 可自定义帧间持续时间
  • 支持JPG、PNG等常见图片格式
  • 自动优化图片格式以创建最佳GIF
  • 高性能和响应迅速
  • 处理后自动清理临时文件

API端点

1. 获取API信息

  • 方法: GET
  • 路径: /
  • 描述: 返回欢迎消息和基本API信息
  • 响应示例: json { "message": "Welcome to Image to GIF Converter API. Use POST /convert-to-gif endpoint to convert images to GIF." }

2. 转换图片为GIF

  • 方法: POST
  • 路径: /convert-to-gif
  • 请求参数:
    名称 类型 必填 默认值 描述
    images Files - 要转换为GIF的多张图片文件
    duration Integer 500 帧间持续时间(毫秒)
  • 响应:
    • Content-Type: image/gif
    • 生成的动画GIF文件下载

代码示例

Python

python import requests

url = "https://your-rapidapi-url.com/convert-to-gif" headers = { "X-RapidAPI-Key": "YOUR_API_KEY", "X-RapidAPI-Host": "your-rapidapi-host.com" }

files = [ (images, (image1.jpg, open(image1.jpg, rb), image/jpeg)), (images, (image2.jpg, open(image2.jpg, rb), image/jpeg)) ]

payload = { duration: 500 # 500ms between frames }

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

Save the response content to a file

with open(animation.gif, wb) as f: f.write(response.content)

Node.js

javascript const axios = require(axios); const FormData = require(form-data); const fs = require(fs); const path = require(path);

const formData = new FormData(); formData.append(images, fs.createReadStream(path.resolve(image1.jpg))); formData.append(images, fs.createReadStream(path.resolve(image2.jpg))); formData.append(duration, 500);

const options = { method: POST, url: https://your-rapidapi-url.com/convert-to-gif, headers: { X-RapidAPI-Key: YOUR_API_KEY, X-RapidAPI-Host: your-rapidapi-host.com, ...formData.getHeaders() }, data: formData, responseType: arraybuffer };

axios.request(options) .then(function (response) { fs.writeFileSync(animation.gif, response.data); console.log(GIF saved successfully!); }) .catch(function (error) { console.error(error); });

使用场景

  1. 社交媒体内容: 为社交媒体帖子和故事创建动画GIF
  2. 网站动画: 生成加载动画或装饰元素
  3. 数字营销: 创建动画产品展示或促销内容
  4. 教育内容: 将图片序列转换为动画教程
  5. 移动应用: 为移动应用生成动画内容
  6. 电子商务: 创建动画产品演示或图片库

错误处理

常见错误响应: json { "detail": "No images provided" }

json { "detail": "Error processing image [filename]: [error message]" }

json { "detail": "No valid images were processed" }

注意事项

  • 最大文件大小和图片数量可能受订阅计划限制
  • 支持的图片格式包括: JPG, JPEG, PNG, BMP等常见格式
  • API自动优化图片以适合GIF格式
  • 所有临时文件在处理后自动清理
  • 为获得最佳效果,请使用尺寸相似的图片

提供商信息

  • API创建者: IMG Ram
  • 订阅者数量: 2
  • 类别: Video, Images
5,000+
优质数据集
54 个
任务类型
进入经典数据集
二维码
社区交流群

面向社区/商业的数据集话题

二维码
科研交流群

面向高校/科研机构的开源数据集话题

数据驱动未来

携手共赢发展

商业合作