# Graphviz doesn't render jpg images

**URL:** <https://forum.graphviz.org/t/graphviz-doesnt-render-jpg-images/3002>\
**Category:** Help\
**Created:** [June 2, 2025, 12:31pm UTC](https://forum.graphviz.org/t/graphviz-doesnt-render-jpg-images/3002 "2025-06-02T12:31:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Podbrushkin](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@Podbrushkin](https://forum.graphviz.org/u/Podbrushkin)\
**Post date:** [June 2, 2025, 12:31pm UTC](https://forum.graphviz.org/t/graphviz-doesnt-render-jpg-images/3002/1 "2025-06-02T12:31:08Z")

</div>

I can’t embed jpg into a node. Following produces corrupt png/jpeg/pdf output:

```powershell
@"
digraph {
abc [shape=box label="" image="C:\Users\user\Pictures\ROMANOVS\200px-M35495250.jpg"]
}
"@ | dot -Tpng -O; start noname.gv.png

```

But with -Tsvg, image is displayed correctly. When png file is used as image input, it works fine. Graphviz doesn’t support embedding jpg images?

According to this scheme it should work: [Output Formats | Graphviz](https://graphviz.org/docs/outputs/#image-formats)

```auto
dot - graphviz version 12.2.1 (20241206.2353)
Using render: cairo:cairo
Using device: png:cairo:cairo
libdir = "C:\Users\user\AppData\Local\Programs\Graphviz-12.2.1-win64\bin"
Activated plugin library: gvplugin_dot_layout.dll
Using layout: dot:dot_layout
The plugin configuration file:
        C:\Users\user\AppData\Local\Programs\Graphviz-12.2.1-win64\bin\config6
                was successfully loaded.
    render : cairo dot dot_json fig gd gdiplus json json0 map pic pov ps svg svg_inline tk vrml xdot xdot_json
    layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout : textlayout
    device : bmp canon cmap cmapx cmapx_np dot dot_json emf emfplus eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg json json0 kitty kittyz metafile pdf pic plain plain-ext png pov ps ps2 svg svg_inline svgz tif tiff tk vrml vt vt-24bit vt-4up vt-6up vt-8up wbmp webp xdot xdot1.2 xdot1.4 xdot_json
    loadimage : (lib) bmp eps gd gd2 gif jpe jpeg jpg png ps svg webp
pack info:
  mode undefined
  size 0
  flags 0
  margin 8
pack info:
  mode node
  size 0
  flags 0
network simplex: 1 nodes 0 edges maxiter=2147483647 balance=1
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
Maxrank = 0, minrank = 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
merge2: graph %1, rank 0 has only 1 < 2 nodes
mincross %1: 0 crossings, 0.00 secs.
network simplex: 1 nodes 0 edges maxiter=2147483647 balance=2
network simplex: 1 nodes 0 edges 0 iter 0.00 sec
routesplines: 0 edges, 0 boxes 0.00 sec
Using render: cairo:cairo
Using device: png:cairo:cairo
dot: allocating a 177K cairo image surface (213 x 213 pixels)
Using render: cairo:cairo
Activated plugin library: gvplugin_gd.dll
Using loadimage: jpeg:cairo:gd

```

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [June 2, 2025, 3:26pm UTC](https://forum.graphviz.org/t/graphviz-doesnt-render-jpg-images/3002/2 "2025-06-02T15:26:33Z")

</div>

I don’t believe that Graphviz will convert images from one format (e.g. jpg) to another (e.g. png)

So, either try explicitly converting the jpg to a png before running **dot** (lots of programs will do this) or try producing a jpg as output.

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [June 3, 2025, 2:23am UTC](https://forum.graphviz.org/t/graphviz-doesnt-render-jpg-images/3002/3 "2025-06-03T02:23:08Z")

</div>

I thought this should work.

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [June 3, 2025, 3:19am UTC](https://forum.graphviz.org/t/graphviz-doesnt-render-jpg-images/3002/4 "2025-06-03T03:19:27Z")

</div>

My apologies, I assumed it shouldn’t work but I didn’t test it.  
It does work on Linux, but not on Windows (at least not on Graphviz 12.2.1). A zero length file is created.

I have created an issue for this bug.

> **[\[Windows\] Graphviz creates zero-length output when trying to embed png or jpg...](https://gitlab.com/graphviz/graphviz/-/issues/2694)**
>
> Steps to reproduce (on Windows) dot -Tpng imageTest.gv -o o.png

---

<div class="post-metadata">

**Author:** ![Podbrushkin](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@Podbrushkin](https://forum.graphviz.org/u/Podbrushkin)\
**Post date:** [July 3, 2025, 2:58pm UTC](https://forum.graphviz.org/t/graphviz-doesnt-render-jpg-images/3002/5 "2025-07-03T14:58:25Z")

</div>

Looks like it works as expected with graphviz version 13.1.0.

---

<div class="post-metadata">

**Author:** ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)\
**Post date:** [July 3, 2025, 7:40pm UTC](https://forum.graphviz.org/t/graphviz-doesnt-render-jpg-images/3002/6 "2025-07-03T19:40:58Z")

</div>

I think this might be the same as the first part of

> **[Empty file output on windows installed 64 bit - dot - graphviz version 12.2.0...](https://gitlab.com/graphviz/graphviz/-/issues/2619)**
>
> Steps to reproduce When I execute: dot.exe -v -Tpdf -ogvexport\_small-12\_2\_0-inst.pdf gvexport-small-x.dot \> mensajes-12\_2\_0-inst\_small.txt 2\>&1 or

which was fixed by

> **[Fix parsing of JPEG images (!4216) · Merge requests · graphviz / graphviz ·...](https://gitlab.com/graphviz/graphviz/-/merge_requests/4216)**
>
> The parsing incorrectly started 20 bytes into the file, because imagetype had already read those bytes. This position was almost always in the middle of a segment's...
