Skip to content

Img4Dat

Img4Dat converts a bitmap into an LDraw pattern: the image is reduced to a few colors, the color borders are traced as paths, and the areas are triangulated and saved as an LDraw .dat file. In between you can edit the graph and choose the template, i.e. the part the pattern is placed on.

Download

Version System File
2.0.0 Windows 10/11, 64 bit Img4Dat-2.0.0.zip (approx. 300 KB)

Img4Dat requires the Microsoft .NET 10 Desktop Runtime (x64) from dotnet.microsoft.com. Choose “.NET Desktop Runtime” for Windows x64. If it is missing, Windows shows a message with a download link when Img4Dat is started.

Installation

Unzip the archive into a folder of your choice and start Img4Dat.exe. Nothing is installed. Settings and log files are written next to the program (Settings.xml, Logs\), so use a folder where you have write access.

Quick start

  1. Open Image … – Load the picture (BMP, PNG, JPG, GIF, TIFF).
  2. Colors – Right-click into the source image (left) to add a color to the palette. The quantized image (right) shows the result. Enter the LDraw color number in each palette button. Pencil, Fill and Re-quantize fix single pixels or areas. Undo with Ctrl+U (image).
  3. Find Paths – Traces the borders between the colors.
  4. Edit the graph – Select points (click, Ctrl+click, drag a rectangle) and use the tools above the graph: add, delete, merge points, points on a line or circle, circular arc, Bezier curve, peak. Undo with Ctrl+Z (graph).
  5. Template – Choose the part the pattern is placed on (second toolbar row), then Fit or adjust X, Y and Scale.
  6. Triangulate & Save (Ctrl+S) – Creates the triangles and saves the LDraw pattern file.

Graphs can be saved and loaded (Save Graph / Load Graph) to continue later.

Output

The pattern file contains the header lines

0 !LDRAW_ORG Unofficial_Pattern
0 !LICENSE Licensed under CC BY 4.0 : see CAreadme.txt

Please complete title, author, category and keywords before submitting a pattern to the LDraw Parts Tracker.

Templates

Img4Dat comes with 17 templates:

Part Description View
3070bTile 1 x 1 with Groovefrom above
98138Tile 1 x 1 Round with Groovefrom above
3069bTile 1 x 2 with Groovefrom above
2431Tile 1 x 4 with Groovefrom above
4162Tile 1 x 8from above
3068bTile 2 x 2 with Groovefrom above
14769Tile 2 x 2 Round with Round Underside Studfrom above
87079Tile 2 x 4from above
22385Tile 3 x 2 with Angled Endfrom above
3005Brick 1 x 1from the front
3004Brick 1 x 2from the front
3010Brick 1 x 4from the front
4066bDuplo Brick 1 x 2 x 2 Type 2from the front
3039Slope Brick 45 2 x 2perpendicular to the slope
973Minifig Torsofrom the front
3626bMinifig Head with Blocked Hollow Studfrom the front
3626cMinifig Head with Hollow Studfrom the front

Your own templates

Templates are LDraw files in the Templates folder next to the program. Triangles (type 3 lines) describe the surface the pattern lies on; additional type 2 lines mark hard edges. Optional line:

0 !IMG4DAT PLANE x y z

It sets the view direction onto the pattern surface, pointing from the viewer to the part (LDraw: −Y is up), e.g.:

Line View
0 !IMG4DAT PLANE 0 0 1front (default)
0 !IMG4DAT PLANE 0 1 0top (tiles)
0 !IMG4DAT PLANE 0 0 -1back
0 !IMG4DAT PLANE 1 0 0left side
0 !IMG4DAT PLANE -1 0 0right side
0 !IMG4DAT PLANE 0 1 1a 45° slope seen perpendicularly

All included templates contain such a line. A template first appears centered and fitted to the image. Edges where two template triangles meet at an angle cut the pattern, so no pattern triangle spans a fold.

License

Img4Dat is freeware, not open source. You may use it free of charge, for private and commercial purposes, and pass it on complete and unmodified. The exact terms are in LICENSE.txt in the archive. Img4Dat is provided “as is”, without warranty of any kind. Patterns, graphs and other files you create with Img4Dat belong to you.

LEGO® is a trademark of the LEGO Group, which does not sponsor, authorize or endorse this software. LDraw™ is a trademark of the Estate of James Jessiman.