Skip to content
Docs menu

Convert to PNG

Portable Network Graphics. The API converts 96 formats to PNG. These are the options, by input format.

curl https://api.switchfile.io/v1/convert \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/input.3fr","to":"png","options":{"width":1280}}'

From 43 formats

3fr, arw, bmp, cr2, cr3, crw, dcr, dds, dng, erf, exr, hdr, icns, iiq, j2k, jfif, jp2, jpeg, jpg, jxl, kdc, mef, mos, mrw, nef, nrw, orf, pam, pbm, pcx, pef, pgm, png, pnm, ppm, qoi, raf, rw2, rwl, sr2, srf, srw, tga

  • widthintegerdefault: not set

    Width of the image in pixels.

    1 to 65535 px

  • heightintegerdefault: not set

    Height of the image in pixels.

    1 to 65535 px

  • fitenumdefault: max

    "max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.

    one of max, upscale, crop, scale

  • stripbooleandefault: false

    Remove metadata such as camera data and location.

  • auto_orientbooleandefault: true

    Rotate the image upright according to its EXIF orientation.

From 20 formats

dif, doc, docm, docx, dot, dotm, dotx, fods, fodt, ods, odt, ots, ott, rtf, xls, xlsm, xlsx, xlt, xltm, xltx

  • passwordstringdefault: not set

    Password to open the file.

  • pagesstringdefault: not set

    Pages to convert, for example 1-3,5 or all. Each page becomes its own image.

  • pixel_densityintegerdefault: 150

    Resolution in pixels per inch the pages are rendered at (36 to 600).

    36 to 600 dpi · default in /v2: 300

  • widthintegerdefault: not set

    Width of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

  • heightintegerdefault: not set

    Height of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

From 11 formats

fodp, odp, otp, pot, potm, potx, pps, ppsx, ppt, pptm, pptx

  • passwordstringdefault: not set

    Password to open the file.

From 9 formats

avif, gif, heic, heif, psb, psd, tif, tiff, webp

  • widthintegerdefault: not set

    Width of the image in pixels.

    1 to 65535 px

  • heightintegerdefault: not set

    Height of the image in pixels.

    1 to 65535 px

  • fitenumdefault: max

    "max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.

    one of max, upscale, crop, scale

  • stripbooleandefault: false

    Remove metadata such as camera data and location.

  • auto_orientbooleandefault: true

    Rotate the image upright according to its EXIF orientation.

  • pagesstringdefault: not set

    Pages, frames or layers to convert, for example 1-3,5 or all. Without it, only the first page, frame or layer is converted.

From 6 formats

dxf, emf, fodg, odg, otg, wmf

  • passwordstringdefault: not set

    Password to open the file.

  • pixel_densityintegerdefault: 150

    Resolution in pixels per inch the pages are rendered at (36 to 600).

    36 to 600 dpi · default in /v2: 300

  • widthintegerdefault: not set

    Width of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

  • heightintegerdefault: not set

    Height of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

From 2 formats

cur, ico

  • widthintegerdefault: not set

    Width of the image in pixels.

    1 to 65535 px

  • heightintegerdefault: not set

    Height of the image in pixels.

    1 to 65535 px

  • fitenumdefault: max

    "max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.

    one of max, upscale, crop, scale

  • stripbooleandefault: false

    Remove metadata such as camera data and location.

  • auto_orientbooleandefault: true

    Rotate the image upright according to its EXIF orientation.

  • pagesstringdefault: not set

    Pages, frames or layers to convert, for example 1-3,5 or all. Without it, the largest icon in the file is converted.

From CSV

  • delimiterstringdefault: ,

    Field separator of the input file: one character or comma, semicolon, tab, pipe, space.

  • encodingstringdefault: utf-8

    Text encoding of the input file, for example utf-8, windows-1252, iso-8859-1 or utf-16.

  • passwordstringdefault: not set

    Password to open the file.

  • pagesstringdefault: not set

    Pages to convert, for example 1-3,5 or all. Each page becomes its own image.

  • pixel_densityintegerdefault: 150

    Resolution in pixels per inch the pages are rendered at (36 to 600).

    36 to 600 dpi · default in /v2: 300

  • widthintegerdefault: not set

    Width of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

  • heightintegerdefault: not set

    Height of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

From PDF

  • pagesstringdefault: not set

    Pages to convert, for example 1-3,5 or all. Each page becomes its own image.

  • pixel_densityintegerdefault: 150

    Resolution in pixels per inch the pages are rendered at (36 to 600).

    36 to 600 dpi · default in /v2: 300

  • widthintegerdefault: not set

    Width of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

  • heightintegerdefault: not set

    Height of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

  • passwordstringdefault: not set

    Password to open the PDF.

From SVG

  • widthintegerdefault: not set

    Width of the image in pixels.

    1 to 65535 px

  • heightintegerdefault: not set

    Height of the image in pixels.

    1 to 65535 px

  • fitenumdefault: max

    "max" fits inside width and height without enlarging, "upscale" may enlarge, "crop" fills and crops, "scale" stretches to the exact size.

    one of max, upscale, crop, scale

  • stripbooleandefault: false

    Remove metadata such as camera data and location.

  • auto_orientbooleandefault: true

    Rotate the image upright according to its EXIF orientation.

  • pixel_densityintegerdefault: 72

    Resolution in pixels per inch the drawing is rendered at.

From TSV

  • delimiterstringdefault: tab

    Field separator of the input file: one character or comma, semicolon, tab, pipe, space.

  • encodingstringdefault: utf-8

    Text encoding of the input file, for example utf-8, windows-1252, iso-8859-1 or utf-16.

  • passwordstringdefault: not set

    Password to open the file.

  • pagesstringdefault: not set

    Pages to convert, for example 1-3,5 or all. Each page becomes its own image.

  • pixel_densityintegerdefault: 150

    Resolution in pixels per inch the pages are rendered at (36 to 600).

    36 to 600 dpi · default in /v2: 300

  • widthintegerdefault: not set

    Width of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

  • heightintegerdefault: not set

    Height of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

From TXT

  • encodingstringdefault: utf-8

    Text encoding of the input file, for example utf-8, windows-1252, iso-8859-1 or utf-16.

  • passwordstringdefault: not set

    Password to open the file.

  • pagesstringdefault: not set

    Pages to convert, for example 1-3,5 or all. Each page becomes its own image.

  • pixel_densityintegerdefault: 150

    Resolution in pixels per inch the pages are rendered at (36 to 600).

    36 to 600 dpi · default in /v2: 300

  • widthintegerdefault: not set

    Width of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px

  • heightintegerdefault: not set

    Height of each page in pixels; the page keeps its shape. Overrides pixel_density.

    1 to 20000 px