Skip to main content

This module generates a 3D model of a lithophane from an given image.

Project description

Python Lithophane Generator

This module generates a 3D model of a lithophane from an given image. The output file is a STL file. It can then be printed on a 3D printer.

"A lithophane is a thin plaque of translucent material, [...] which has been moulded to varying thickness, such that when lit from behind the different thicknesses show as different shades, forming an image." - Wikipedia

The code is originally written by Dirk Colbry (original repository) and edited by Robert Hülsmann. Core of this module uses matlab-stl to write stl files written by Rick van Hattem.

Example Lithophane

How to Install

pip install lithophane

How to Use

import lithophane as li

# 1. Generate xyz point cloud from image
x, y, z = li.jpg_to_stl("path/to/image.jpeg")

# 2. Generate stl model from point cloud
model = li.make_mesh(x, y, z)

# 3. Save model as stl file
model.save("path/to/model.stl")

Command Line Interface

lithophane the_best_siblings.jpeg --width 100 --frame 3

Optional Arguments

  • --width or -w to set the width of the lithophane. Default is image width with a resolution of 10 pixels per millimeter. The height is calculated automatically.
  • --depth or -d to set the depth of the lithophane. Default is 3mm. More depth means more contrast but also longer print time and less translucency.
  • --offset or -o to set the offset of the lithophane. Default is 0.5mm. It's like the back of the lithophane. More offset means more stability but also less translucency. The thickness of the lithophane is the sum of depth and offset.
  • --frame or -f to add a frame around the lithophane. Default is 0mm (no frame). The frame is added to the width and height of the lithophane.
  • --show to show the lithophane in a 3D plot.

After Model Generation

Example Lithophane

After the model is generated, open the STL file in your favorite slicer software to generate the GCODE. Use 100% infill! Then, print it with a (slightliy) translucent filament and delight yourself and your beloved ones with a personalized memento.

Background

If you want to understand how the code works, please take a look into the original repository of Dirk Colbry. There are two jupyter notebooks you can try out.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lithophane-1.0.14.tar.gz (8.3 kB view details)

Uploaded Source

File details

Details for the file lithophane-1.0.14.tar.gz.

File metadata

  • Download URL: lithophane-1.0.14.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for lithophane-1.0.14.tar.gz
Algorithm Hash digest
SHA256 e9c0fae7fb7d136241f75fdb9dd4488112e96297a8019d4ddf2463aa76f231a1
MD5 c34e7fc8b6308237a1435f2a162a5392
BLAKE2b-256 38211f6b519b797a3216a336867a93ceb61b0996ae7e1df5391ff007466949f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page