ODG File Documentation


Summary

An ODG file is a vector drawing saved by LibreOffice Draw or Apache OpenOffice Draw, the open-source equivalent of a simple Microsoft Visio or Illustrator file. It is part of the OpenDocument Format (ISO/IEC 26300), so it is a ZIP archive full of XML. The extension is .odg and the MIME type is application/vnd.oasis.opendocument.graphics. Open it free with LibreOffice Draw on Windows, macOS or Linux; Microsoft Office cannot read it, so export to PDF or PNG to share.

Technical details

FeatureValue
Full nameOpenDocument Graphics (Drawing)
File extension.odg (flat XML variant: .fodg)
MIME typeapplication/vnd.oasis.opendocument.graphics
Format typeVector drawing (ZIP-based XML package)
Container / base formatZIP archive (OpenDocument package)
DeveloperOASIS; reference tool LibreOffice Draw
Introduced2005 (ODF 1.0); ISO/IEC 26300 since 2006
StandardISO/IEC 26300; OASIS ODF 1.3
Open standardYes
Magic number50 4B 03 04 ("PK", ZIP local file header)
Byte orderZIP fields little-endian; XML is text
Identifying entryUncompressed mimetype at offset 30
Drawing markupcontent.xml using ODF draw: namespace
Stylingstyles.xml (page setup, graphic styles)
Embedded imagesPictures/ folder
Native applicationLibreOffice Draw, Apache OpenOffice Draw
Related extensions.odp, .ods, .odt, .otg, .svg
SpecificationOASIS ODF 1.3
File signature (magic bytes)
50 4B 03 04

Offset 0: an ODG is a ZIP archive, so it begins with the ZIP local-file-header signature 50 4B 03 04 (ASCII "PK"). That alone does not distinguish it from any other ZIP or Office file. The reliable marker is the first archive entry: a correctly written OpenDocument package stores an uncompressed mimetype file first, so the ASCII string mimetype appears at offset 30 and its contents, application/vnd.oasis.opendocument.graphics, begin at offset 38.

What is an ODG file?

ODG stands for OpenDocument Graphics, the drawing format of the OpenDocument Format (ODF) family. ODF was standardised by OASIS and adopted as ISO/IEC 26300 in 2006; the drawing document type has existed since ODF 1.0 in 2005. An .odg file is the native "save" format of LibreOffice Draw and the older Apache OpenOffice Draw, the way VSDX is Microsoft Visio's native format. People use Draw, and therefore ODG, for flowcharts, diagrams, posters, org charts, floor plans and simple page layouts.

Technically an ODG file is a ZIP archive that contains XML. The geometry is stored as vector shapes — lines, curves, polygons, text boxes — so a drawing scales to any size without losing quality. Its MIME type is application/vnd.oasis.opendocument.graphics. The rest of this page describes what is inside that ZIP and how the drawing markup encodes shapes.

The ODF package: a ZIP with a required first entry

Open an .odg with any ZIP tool and you see an ordinary archive. Its first bytes are the ZIP local-file-header signature 50 4B 03 04, which is why file managers occasionally misidentify an ODG as a plain ZIP. ODF adds one rule that a bare ZIP does not have: the first entry in the archive must be a file named mimetype, it must be stored uncompressed, and it must carry no extra header field. Because a ZIP stores an uncompressed first entry at a fixed position, that layout guarantees the string mimetype sits at byte offset 30 and the actual media-type string application/vnd.oasis.opendocument.graphics begins at offset 38.

offset 0    50 4B 03 04            ZIP local file header ("PK")
offset 30   6D 69 6D 65 74 79 70 65   ASCII "mimetype"
offset 38   61 70 70 6C 69 63 61 ...   ASCII "application/vnd.oasis.opendocument.graphics"

This is deliberate. It lets the Unix file command and other detectors identify an ODG by reading a handful of bytes at fixed offsets, without unzipping anything or trusting the .odg extension. A package whose mimetype is compressed or misplaced is technically malformed even if applications still open it.

The parts inside the package

Beyond mimetype, an ODG holds a small set of well-known XML files and folders. Each has one job.

EntryWhat it holds
mimetypeUncompressed type string; identifies the package as ODF graphics
content.xmlThe drawing itself: pages, shapes, paths, text
styles.xmlGraphic and paragraph styles, page geometry, master pages
meta.xmlDocument metadata: author, dates, edit statistics
settings.xmlApplication view settings (zoom, active page)
META-INF/manifest.xmlLists every file in the package and its media type
Pictures/Embedded raster images placed on the drawing
Thumbnails/thumbnail.pngPreview image shown by file managers

The manifest.xml under META-INF/ is the package's own table of contents: an application reads it to learn which parts exist and what each contains, rather than scanning the ZIP directory blindly. Everything that renders on screen comes from content.xml and styles.xml.

Inside content.xml: the drawing markup

The drawing lives in content.xml as XML in the ODF draw: and office: namespaces. The document root wraps an <office:drawing> body, which contains one <draw:page> per page. Each shape on a page is its own element with position and size attributes measured in real units (usually centimetres).

<office:body>
  <office:drawing>
    <draw:page draw:name="page1" draw:master-page-name="Default">
      <draw:rect svg:x="2cm" svg:y="3cm"
                 svg:width="6cm" svg:height="4cm"
                 draw:style-name="gr1"/>
      <draw:line svg:x1="2cm" svg:y1="7cm"
                 svg:x2="8cm" svg:y2="7cm"/>
      <draw:custom-shape ...> ... </draw:custom-shape>
    </draw:page>
  </office:drawing>
</office:body>

Basic shapes have dedicated elements: <draw:rect>, <draw:ellipse>, <draw:line>, <draw:polygon> and <draw:path>. Notice the attributes use the svg: prefix — ODF borrows SVG's coordinate and path conventions, so a draw:path carries an svg:d attribute with the same move/line/curve commands an SVG path uses. Text frames are <draw:frame> elements wrapping a <draw:text-box>, and an embedded picture is a <draw:frame> whose <draw:image> child points via xlink:href at a file inside the Pictures/ folder. Because every shape is a resolution-independent vector definition, the same file prints crisply at A0 or renders sharply on screen.

Styles, master pages and page geometry

ODF separates content from formatting. A shape in content.xml references a style by name (draw:style-name="gr1"), and that style is defined once in styles.xml or in the automatic-styles block. A graphic style holds fill colour, line width, dash pattern, shadow and text properties, so changing one style restyles every shape that uses it. styles.xml also defines master pages: reusable page backgrounds and the page geometry (dimensions, margins, orientation) that each draw:page inherits through its draw:master-page-name attribute. This is the same styling model used across the whole ODF family, which is why ODT text documents and ODP presentations share the mechanism.

ODG within the OpenDocument family

ODG is one member of a set that all share the ZIP-plus-XML package and differ only in the body markup and the mimetype string. ODT is a text document, ODS a spreadsheet, ODP a presentation, and ODG a single drawing canvas. That common structure is why the same LibreOffice code opens all of them, and why an ODG can be unzipped and inspected with ordinary tools. ODF predates Microsoft's own move to ZIP-and-XML Office formats; the two families are conceptually similar but not interchangeable, and Microsoft Office does not read ODG, which is the usual source of confusion when someone receives one.

Frequently asked questions

Why can't Microsoft Office open an ODG file?

Word, PowerPoint and Visio simply do not include an import filter for the OpenDocument graphics type, even though Office reads ODT and ODS. Open the ODG in LibreOffice Draw instead and export it to PDF, PNG or SVG, any of which Office can place.

Why does ODG use SVG-style attributes?

ODF reuses parts of the W3C SVG vocabulary rather than inventing its own. Coordinates use svg:x/svg:y and freeform curves use an svg:d path string with the same command letters as SVG, which is one reason exporting an ODG to SVG is usually high-fidelity for simple drawings.

References