Free plan

Passport photo

Cut a portrait to the size of an ID or passport photo
POST
/v1/images/passport-photo

About this tool

Crops a portrait to the size and shape that a country asks for in an ID photo, at print quality, on the background colour you need. It can also lay several copies on a print sheet. It does not find the face for you, so you set the zoom and position yourself, and can show guide lines to check.
For example, you make a visa photo from a selfie and print four copies on one sheet.

How to use it

  1. Choose this tool.
  2. Add your portrait photo with Upload or drag and drop.
  3. Choose the country, or your own size.
  4. Adjust the zoom and position until the face fits, and choose a print sheet if you want.
  5. Press Generate and download the result.

What you get back

You get a new photo cut to the right size, or a print sheet with copies, ready to download.
GOOD TO KNOW
Check the result against the rules of the authority that asks for the photo: head size, expression and background rules differ. The face is not detected. One picture counts as one image.
TEST IT LIVE

Try Passport photo in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Images
Plan
Free
Method
POST
Endpoint
/v1/images/passport-photo
Tool ID
images.passport-photo
Authentication
API key
Accepts
JPEG, PNG, WEBP, GIF, AVIF, TIFF +15 more
Background jobs
Yes
Usage group
Image
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/images/passport-photo" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'images=@photo.jpg' \
  -F 'width_mm=10' \
  -F 'height_mm=10' \
  -F 'dpi=300'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.images.passportPhoto({
    "images": 'photo.jpg',
    "width_mm": 10,
    "height_mm": 10,
    "dpi": 300
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->images()->passportPhoto([
    'images' => 'photo.jpg',
    'width_mm' => 10,
    'height_mm' => 10,
    'dpi' => 300,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Cut a portrait to the size and shape of an ID photo for a country (or your own size), at print resolution, on the background colour needed, and lay several copies on a print sheet. The face is not detected: you set the zoom and position.

Passport photo accepts JPEG, PNG, WEBP, GIF, AVIF, TIFF, SVG, SVGZ, BMP, ICO, APNG, PNM and 9 more. You can send several files in one request.

Passport photo is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/images/passport-photo with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.