API Call Example

curl example
curl --request POST \
  --url https://api.freepik.com/v1/ai/image-upscaler \
  --header 'Content-Type: application/json' \
  --header 'x-freepik-api-key: <YOUR_API_KEY>' \
  --data '{
    "image": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...",
    "scale_factor": "4x",
    "optimized_for": "nature_n_landscapes",
    "prompt": "Enhance details and colors",
    "creativity": 2,
    "hdr": 1
  }'

Okay that's cool but take me to the code

API Reference: Upscale an image with Magnific

Overview

Freepik API uses Magnific.ai technology, now available as a comprehensive API service.

The Magnific Upscaler enhances images to higher resolutions. This powerful tool does more than just increase image size - it also improves quality and adds detail. By leveraging advanced upscaling technology, our API allows you to transform your images with custom prompts and fine-tuned parameters, achieving impressive results.

Use Cases

The Magnific Upscaler can be applied to a wide range of image types and industries, including:

  • Portraits: Enhance facial details and skin textures
  • Illustrations: Sharpen lines and improve color vibrancy
  • Video game assets: Upscale textures and character models
  • Landscapes: Bring out intricate details in nature scenes
  • Science fiction imagery: Enhance futuristic and space-themed visuals
  • Fantasy art: Improve magical and mythical elements
  • Film stills: Increase resolution for better visual quality
  • Graphic design: Upscale logos and marketing materials
  • Architectural renderings: Enhance building details and textures, jumping from quick sketches to high quality renders
  • Interior design: Improve quality of room layouts and furniture details
  • Food photography: Bring out textures and colors in culinary images

Upscale an Image with Magnific

Create an upscaling task for an image.

POST /v1/ai/image-upscaler

Upscale an image using Magnific AI

Key Parameters

image
string
required

Base64 encoded image to upscale. The output is capped at 10K resolution images, trying to upscale above that will result in an error.

webhook_url
string

Webhook URL to receive the upscaled image once it’s ready

scale_factor
string
default: "2x"

Configure scale factor of the image (2x, 4x, 8x, 16x)

optimized_for
string
default: "standard"

This parameter allows you to tailor the upscaling process for specific image types or styles. Options include:

  • standard: General-purpose upscaling
  • soft_portraits: Optimized for portrait photos with softer details
  • hard_portraits: For portraits requiring sharper details
  • art_n_illustration: Ideal for artwork and illustrations
  • videogame_assets: Tailored for game graphics and textures
  • nature_n_landscapes: Optimized for outdoor and landscape photos
  • films_n_photography: Suited for cinematic and professional photography
  • 3d_renders: Specialized for 3D rendered images
  • science_fiction_n_horror: Tailored for sci-fi and horror genre visuals
prompt
string

Guide the upscaling process. For AI-generated images, reusing the original prompt can significantly improve results. You can also use prompts to alter images during upscaling (e.g., transforming a city into ruins, typically after at least 4x upscale).

Tip: Use weights to emphasize parts of your prompt. Add a number in parentheses (1 to 1.4) after a phrase, like “(beautiful green eyes:1.3)“. This is useful for countering unwanted effects. For example, to prevent aging in faces, try: “(young woman:1.3), (cute young face:1.2), (cute:1.2)“.

creativity
integer
default: "0"

Increase or decrease AI’s creativity (-10 to 10). Higher values allow the AI to “hallucinate” additional details, potentially achieving greater realism but moving further from the original image. Be cautious with very high values as they can lead to strange results.

hdr
integer
default: "0"

Increase or decrease the level of definition and detail (-10 to 10). Higher values enhance definition, but very high values may result in an artificial appearance or blotches.

resemblance
integer
default: "0"

Adjust the level of resemblance to the original image (-10 to 10). Higher values make the generation more similar to the original, but very high values can cause blotches or a dirtier look. Lower values give more freedom to the generation.

fractality
integer
default: "0"

Control the strength of the prompt and intricacy per square pixel (-10 to 10). Lower values reduce detail but typically result in fewer glitches. Higher values amplify your prompt in smaller areas, useful for intricate images like fantasy maps. Can create interesting artistic effects at high values.

engine
string
default: "automatic"

Magnific model engines:

  • automatic: Default choice
  • magnific_illusio: Better for illustrations, landscapes, and nature. Smoother results and removes JPEG artifacts. Good for the first pass of multiple upscales.
  • magnific_sharpy: Ideal for realistic images like photographs. Provides the sharpest and most detailed results, but doesn’t remove JPEG artifacts and may create “fake” ones.
  • magnific_sparkle: A middle ground between Illusio and Sharpy. Good for realistic images and removes JPEG artifacts.

Tip: For multiple upscales, experiment with different engines. For example, start with Illusio and finish with Sharpy to find the best result for your image style.

Authentication

Include the x-freepik-api-key header in your requests for authentication. Keep this key secure and don’t share it with others.

Webhook

If you provide a webhook_url, you’ll receive a POST request to that URL when the upscaling task is complete. The webhook payload will include the task status and the URL of the upscaled image.

Get Upscaling Task Status

You can check the status of an upscaling task using the task ID returned from the initial request.

GET /v1/ai/image-upscaler/{task-id}

Get the status of an upscaling task

List All Upscaling Tasks

Retrieve a list of all your upscaling tasks.

GET /v1/ai/image-upscaler

Get the status of all upscaling tasks

Pricing and Usage

To access the Magnific Upscaler feature:

  1. Generate an API key if you haven’t already.
  2. Upgrade your account to a premium plan at the Billing Dashboard.

Once upgraded, you’ll have access to the Magnific Upscaler along with other premium features.

Pricing is based on a pay-as-you-go model, with no prepayment or commitment required. You’ll only be charged for the upscales you actually perform.

The cost per image upscale depends on the output image area in pixels, which is determined by:

  • The dimensions of the input image
  • The upscale factor applied (e.g., 2x, 4x, 8x, 16x)

Larger output images result in higher costs per upscale. Pricing tiers are applied based on the final output size, ensuring transparency and control over your usage.

Here we have included some pricing examples.

For more detailed pricing information, visit the Billing Dashboard.

Rate Limiting

Rate limits are 250 upscales per day for upgraded accounts. If you need more upscales, contact our team and we will study your case.

Important Terms Of Use remark

The API Services are provided solely to enhance the functionality of the API Client and must not be used to create any standalone service or application with features that directly replicate or compete with magnific.ai or freepik.com products. The API Client must maintain a substantially different purpose and functionality from them. For the sake of clarity, fair use would involve embedding the API within a broader application, such as a videogame, where the API Services support but do not define the primary functionality. However, creating an application such as an independent image upscaling service, would constitute a breach of these Terms and Conditions. In such cases, Freepik reserves the right to terminate the Agreement and revoke the license and access to the services at any time. You can read the full Terms of Use here.

Frequently Asked Questions

Need Help?

For questions or custom requirements, contact the Freepik sales team.