Skip to content
Microlink + Magnific

Extract images from any URL and upscale them with AI

Microlink returns the main image of any URL, along with its dimensions. When that image is too small for where it's going, Magnific upscales it with AI — both steps run on hosted URLs, so nothing gets downloaded or re-uploaded in between.

Magnific AI image upscaler
What it does

From a URL to a high-resolution image

Say you're pulling product shots, article images, or design references from pages you don't control. Microlink extracts the main image of any URL and returns it as a hosted image, with its real width and height. When the source only gives you a small version, you send that URL to Magnific to upscale it with AI.

Magnific returns the result as another hosted URL, so the upscaled image is ready to use without a storage step in between.

Why it works

Why it fits together — and when it's worth it

Both services speak URLs, and Microlink's metadata tells you whether the second call is even needed. Here's where that pays off.

01 · URL in, URL out
Microlink's output URL is Magnific's input.
Microlink returns the image as a hosted URL plus its width and height, and that URL is exactly what Magnific takes as input. The result comes back as another URL, so nothing has to be downloaded, stored, or re-uploaded between the two.

This shines for product catalogs and aggregators — you're pulling images from supplier or marketplace pages you don't host, so the image never has to touch your servers.

02 · Upscale only when needed
Decide from the dimensions before you spend a credit.
Because you get width and height up front, you can upscale only when the source is below your target. A rough rule: target width = output size in inches × 300 for print, or 2× the on-screen slot for retina. Compare that to image.width and skip the call when it already clears the bar.

That's how you catch the cases that actually need help: print (around 300 DPI, so a 1200px image won't fill an A4 page), an editorial hero (a 1200×630 lead image is small at 2× retina), or design references scaled up for comps and decks.

03 · Faithful by default
Precision mode upscales without inventing detail.
This uses Magnific's Precision mode (flavor: 'photo'), which keeps the upscaled image true to the original instead of hallucinating new detail — which matters when it's a real product or photo, not generative art.

Fidelity matters most for real product shots and photos. If the source already serves a high-resolution image, skip the upscale and use it directly — and for small UI bits like favicons or logos, it usually isn't worth it.

How it works

Two requests: extract, then upscale on demand

First, ask Microlink for the page's main image and its dimensions. Then only when the resolution is below your target, send that hosted URL to Magnific and poll the task until the upscaled image is ready.

1 · Extract the image
import mql from '@microlink/mql'

// Get the main image (og:image) of any URL, including width/height
const { data } = await mql('https://example.com')
const image = data.image // { url, width, height, type, size }
2 · Upscale when needed
const TARGET_WIDTH = 2048

async function ensureHighRes (image) {
  // Microlink already returns the dimensions: only upscale if needed
  if (image.width >= TARGET_WIDTH) return image.url

  // Send the hosted URL straight to Magnific (URL input = maximum quality)
  const create = await fetch(
    'https://api.magnific.com/v1/ai/image-upscaler-precision-v2',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'x-magnific-api-key': process.env.MAGNIFIC_API_KEY
      },
      body: JSON.stringify({
        image: image.url,
        scale_factor: 4,
        flavor: 'photo'
      })
    }
  )
  const { data: task } = await create.json()

  // Magnific is async: poll the task until it is finished
  while (true) {
    const res = await fetch(
      `https://api.magnific.com/v1/ai/image-upscaler-precision-v2/${task.task_id}`,
      { headers: { 'x-magnific-api-key': process.env.MAGNIFIC_API_KEY } }
    )
    const { data } = await res.json()
    if (data.status === 'COMPLETED') return data.generated[0]
    if (data.status === 'FAILED') throw new Error('Magnific upscale failed')
    await new Promise(resolve => setTimeout(resolve, 3000))
  }
}

No image came back? Some pages don't expose a main image at all. In that case you can fall back to Magnific's image generator and create one from the page's title and description — handy for a placeholder or social card, as long as a synthetic image is acceptable there.

Ready to extract and upscale any image?

Pull the main image from any URL with a single Microlink call, then upscale it on demand — drop the whole pipeline into your product.