A working code example for upscaling low-resolution images via the Printcart API. Enlarge a product photo 2× or 4× so it prints sharp instead of blurry — no Photoshop plugin, no desktop app. Runs on Node.js/TypeScript via @printcart/sdk-core, and needs a Printcart API key to call the real API.
git clone https://github.com/Printcart/printcart-image-upscale-sdk.git
cd printcart-image-upscale-sdk
npm install
cp .env.example .env # add your PRINTCART_API_KEY
npm startimport { createPrintcartClient } from '@printcart/sdk-core'
const printcart = createPrintcartClient({ apiKey: process.env.PRINTCART_API_KEY! })
const job = await printcart.upscale.run({
fileUrl: 'https://example.com/low-res-photo.jpg',
designId: 'my-design-001',
scale: 2, // or 4
})
console.log(job.data.correctedFileUrl) // upscaled PNG, valid 24hImage upscaling isn't a standalone endpoint on Printcart's API — it's a Preflight AI fix job (fixTypes: ['upscale_resolution_2x' | '_4x']) created from a preflight report of the same image. upscale.run() is a convenience wrapper that does both steps (create the report, create the AI job, poll it to completion) so callers who only want "upscale this image" don't need to know that two-step shape.
This uses Lanczos upscaling, not AI super-resolution — it enlarges cleanly but does not invent new detail. That's a deliberate, documented behavior of the underlying service, not a limitation of this example.
200 tokens per job (flat — not per fix), deducted when the job is created. Automatically refunded if the job fails.
Does this generate new detail (AI super-resolution), or just enlarge cleanly? It enlarges cleanly using Lanczos resampling — it does not hallucinate new detail the way some AI super-resolution models do. This is intentional: predictable, artifact-free output for print, not a "creative" upscale.
What's the maximum scale factor?
2× or 4×, selected via the scale option.
Can I combine upscaling with other fixes, like bleed or color-mode conversion, in one job?
Yes, at the preflight.createAiJob level (which upscale.run() wraps) you can pass multiple fixTypes in one job — this example only demonstrates the upscale-only case for clarity.
Why does it need a preflight report first instead of a direct "upscale this URL" call?
That's the real shape of Printcart's underlying API — an AI fix job always originates from a report. upscale.run() exists specifically to hide that from callers who don't need the report for anything else.
Where's the full API reference?
This repo is a runnable example, not the full docs. For every field and endpoint, see the @printcart/sdk-core package.
@printcart/sdk-core— the full SDK (also covers background removal, preflight, face crop, bulk QR, face matching)- Preflight / DPI checker example — the full report + AI-fix-job flow this repo wraps
- Background removal example
- printcart.com — the Print-on-Demand platform this API belongs to
The example code in this repo is MIT. The Printcart API itself and @printcart/sdk-core require a Printcart account and API key to use — see printcart-sdk's LICENSE (Business Source License 1.1).