Convert to PDF/Image API
  1. Image
Convert to PDF/Image API
  • Getting Started
  • PDF
    • Convert a web page URL to PDF
      POST
    • Convert HTML content to PDF
      POST
    • Convert a document to PDF
      POST
    • Compress a PDF file
      POST
    • Merge multiple PDF files into one
      POST
    • Split a PDF file
      POST
    • Convert PDF to images
      POST
    • Remove metadata from PDF
      POST
    • Convert PDF to DOCX
      POST
  • Image
    • Capture a web page as an image
      POST
    • Convert images to PDF
      POST
    • Compress image
      POST
  • Schemas
    • Schemas
      • ErrorResponse
      • PdfUrlRequest
      • PdfHtmlRequest
      • PdfDocRequest
      • PdfCompressRequest
      • PdfMergeRequest
      • PdfSplitRequest
      • ImageUrlRequest
      • PdfRemoveMetadataRequest
      • ImageToPdfRequest
      • PdfToDocRequest
      • PdfToImageRequest
      • ImageCompressRequest
  1. Image

Compress image

POST
/v1/image/compress
Compress and optionally resize an image with format conversion support

Request

Authorization
API Key
Add parameter in header
x-api-key
Example:
x-api-key: ********************
or
Body Params multipart/form-dataRequired

Responses

🟢200OK
image/jpeg
Compressed image file
🟠400Bad Request
🟠401Unauthorized
🔴500Internal Server Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.convert2pdfapi.com/v1/image/compress' \
--header 'x-api-key: <api-key>' \
--form 'imageFile=@""' \
--form 'fileName="compressed"' \
--form 'quality="80"' \
--form 'format=""' \
--form 'width=""' \
--form 'height=""' \
--form 'maintainAspectRatio="true"'
Response Response Example
400 - No file provided
{
    "status": "error",
    "message": "No image file uploaded"
}
Modified at 2025-10-24 10:13:01
Previous
Convert images to PDF
Next
ErrorResponse
Built with