Skip to content
pdfconversionapi

MSG to PNG API

POST an Outlook .msg file to /v2/convert/msg/to/png and get a PNG for each page of the message. With ImageWidth=900, our two-page site report came back as two 900 × 1273 images, the first holding the header, schedule table and progress chart.

Endpoint
POST /v2/convert/msg/to/png
Accepts
msg
Sample timing
37 ms median of 5 runsHow we measure
Request size
Up to 10 MB on the Free plan or 100 MB on paid plans, all files together

Request and response

Every sample below ran against the API before this page was published. Set PDFCONVERSIONAPI_KEY to your key and run it as is.

curl -sS -X POST \
  https://api.pdfconversionapi.com/v2/convert/msg/to/png \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@site-report-week-9.msg \
  --form-string ImageWidth=900 \
  -o response.json

# FileData is base64. Save the first file in converted/,
# or print the JSON error.
if jq -e '.Files' response.json > /dev/null; then
  mkdir -p converted
  name=$(jq -r '.Files[0].FileName' response.json)
  jq -r '.Files[0].FileData' response.json \
    | base64 --decode > "converted/$name"
else
  cat response.json
fi
200 OK37 ms median2 files, 464 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.037,
  "Files": [
    {
      "FileName": "site-report-week-9-1.png",
      "FileExt": "png",
      "FileSize": 359594,
      "FileData": "iVBORw0KGgoAAAANSUhEUgAA…"
    },
    {
      "FileName": "site-report-week-9-2.png",
      "FileExt": "png",
      "FileSize": 115686,
      "FileData": "iVBORw0KGgoAAAANSUhEUgAA…"
    }
  ]
}

Response from our test run on 2026-11-03. ConversionTime shows the median of 5 runs. FileData is shortened here; the real response carries the whole file as base64.

The sample, converted

The same file the code sends. Download the input and the output and compare them yourself.

First page of site-report-week-9-1.png, rendered by the API
Input
site-report-week-9.msg (48 KB)
Output
site-report-week-9-1.png (351 KB)site-report-week-9-2.png (113 KB)
Source
A fictional Outlook message with a weekly building site report, an inline chart and two attachments, written by us and saved to the Outlook file layout by our own script. (CC0-1.0). How it was made
Made by
2026-11-04, API build 9eeeb0640aba

Parameters

Send these as form fields next to the file. Names are case-insensitive. If you set one of the documented options below that we don't support yet, the request fails with a 400 that names it instead of returning a file made without it.

ParameterWhat it does
ImageWidthintegerWidth of each PNG in pixels. The sample's 900 gives 900 × 1273 A4 pages, drawn at that size. No DPI is written when only a pixel size is asked for.Values: 1–20,000
ImageHeightintegerHeight in pixels; with ImageWidth too, the page is fitted inside the two.Values: 1–20,000
ImageResolutioninteger, default 150Resolution used when no pixel size is given, and stored in the PNG when sent. The default 150 makes the sample's pages 1240 × 1753 and 529,702 and 177,347 bytes.Values: 36–600
PageRangestringOnly these pages. Page 2 of the sample holds the last body paragraph, the boxed site-visit note, the sign-off, a fictional-data note and the attachment line, so PageRange=1 drops all of those.Values: 1, 2, 1-2, 2-
ConvertHeaderboolean, default truefalse removes the subject heading and the sender, To, Cc and Date rows from page 1.
PageSizeenum, default a4Paper the message is split into pages on. Even on legal the sample needs a second, nearly empty page.Values: a0–a9, b0–b5, letter, legal, ledger
PageOrientationenum, default portraitTurns the paper sideways, for wide HTML such as a newsletter or a table with many columns.Values: portrait, landscape
PageWidthintegerCustom paper width, millimeters.Values: 10–30,000 (mm)
PageHeightintegerCustom paper height, millimeters.Values: 10–30,000 (mm)
MarginTopinteger, default 5Top page margin in mm.Values: 0–500 (mm)
MarginRightinteger, default 5Right page margin in mm.Values: 0–500 (mm)
MarginBottominteger, default 5Bottom page margin in mm.Values: 0–500 (mm)
MarginLeftinteger, default 5Left page margin in mm.Values: 0–500 (mm)
ColorSpaceenum, default defaultgray and monochrome give one-channel PNGs; rgb gives the same three-channel PNG as the default, which has no alpha channel; cmyk is refused.Values: default, rgb, gray, monochrome
TransparentColorstringAny pixel of exactly this color is made transparent.Values: Color names, #RRGGBB or R,G,B
BackgroundColorstring, default whiteFill under the page where the message paints nothing.Values: Color names, #RRGGBB or R,G,B
IgnoreAttachmentErrorsboolean, default falseRead and then ignored; attachments are listed, not converted.
Mergeboolean, default trueRead and then ignored; each page is its own PNG.
FileNamestringStem for the output names, in place of site-report-week-9.
StoreFileboolean, default falseReturn 3-hour download links in Files[].Url instead of base64 data.

Not supported yet

Setting one of these to anything but its default returns 400.

OptionWhat to do instead
TemplateFileAny value gives 400 "TemplateFile is not supported yet".
DateTimeFormatAny value gives 400. The Date row is the saved header text as written.
ConvertAttachmentstrue gives 400. Pull attachments out with /v2/convert/email/to/extract, which reads .msg files too.

What carries over, and what doesn't

Kept

  • The HTML body Outlook stores as binary data, with its style element: the blue table headings, the green and red status text and the shaded site-visit note
  • The progress chart, an attachment with a content ID that the HTML shows through cid:, drawn in place and left out of the attachment list
  • The sender as name and address, both To recipients joined with a comma, and the Cc
  • The Date row exactly as written in the saved internet headers: Mon, 26 Oct 2026 08:30:00 -0700
  • Right-aligned money columns and the numbered list of decisions
  • The names and sizes of the other attachments, printed on the last page: rfi-log-week-9.csv (321 B) and east-wall-opening.jpg (18 KB)

Lost or not yet supported

  • The Date row, when the file has no saved internet headers. A draft we built with a sent time but no headers was drawn without one.
  • Bcc recipients, and the fields of other Outlook item types, such as a meeting's location or a contact's phone numbers.
  • Pictures the HTML links to on the web, which are never downloaded.
  • Formatting stored only as Outlook's RTF body. When there is no HTML body and the RTF was not made from HTML, the plain text is drawn.
  • Fonts the server does not have. The sample asks for Calibri and is drawn with Carlito, which has the same character widths; other missing fonts fall back to the server's own.
  • Selectable text and links; a PNG holds pixels only.

Limits

  • One .msg per request; a second file returns 400 "this conversion takes exactly one file".
  • Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
  • A damaged or cut-off file returns 422 "the input file could not be read: the Outlook message is damaged"; our sample cut to 4,000 or 20,000 bytes got that answer.
  • Other Office 97-2003 files share the container format. A .ppt sent here returns 422 "the input file could not be read: this is not an Outlook message".
  • Files saved with 4096-byte sectors (compound file version 4) return 422; the reader handles the 512-byte layout.
  • Up to 2,000 pages, pages of at most 16,000 px a side and 100,000,000 pixels, and 120 seconds per request.

Where teams use it

Previews of .msg files people upload

When people upload messages saved from Outlook, you receive .msg files that a browser cannot display. Convert each upload to PNG and show page 1 as the preview next to the file.

Messages filed to a project or case

When an Outlook add-in or a mailbox export saves messages into a project record, a PNG of page 1 lets people see the subject, sender, date and opening of each one in a list without downloading it.

Screens for review and redaction tools

Tools that annotate images can mark up a PNG of the message without understanding the Outlook format. The page keeps the layout and colors of the HTML body.

Questions

Which part of the .msg is drawn?

The HTML body when there is one, whether Outlook saved it as binary data (as in the sample) or as text. Without it, the converter looks for HTML that Outlook wrapped inside the compressed RTF body, then the plain-text body. The subject, sender, To, Cc and Date go on top unless you send ConvertHeader=false.

Why does the Date look different from an .eml conversion?

For .msg files the Date row is copied from the internet headers Outlook saved with a received message, as written there, here "Mon, 26 Oct 2026 08:30:00 -0700". An .eml is reformatted to ISO 8601. A .msg without those headers gets no Date row at all.

Can I send an .eml file to this endpoint?

Yes. Both email endpoints look at the first bytes of the upload and read either format; an .eml sent to msg/to/png in our test came back as normal PNG pages.

Was this tested with files saved by Outlook?

Not with Outlook itself; we have no copy in our test setup. The sample was written to the published .msg layout (MS-OXMSG) by our own script, with the HTML body stored as binary data the way Outlook saves it. Files from real Outlook versions may contain things we did not cover.

Convert your first MSG file in a minute.