Lumina can be used as a Python library to programmatically generate lithophanes.
The main function for generating flat (and shaped) lithophanes.
from lumina import flat_lithophane
def flat_lithophane(
image_path: str,
width_mm: float = 100.0,
height_mm: float = 150.0,
max_thickness: float = 3.0,
min_thickness: float = 0.5,
frame_thick_mm: float = 1.0,
frame_height_mm: float = 2.0,
resolution: int = 5,
enhance: bool = False,
shape: str = "rect"
) -> mesh.Mesh:image_path(str): Path to the input image file.width_mm(float, default100.0): Target width of the lithophane in millimeters.height_mm(float, default150.0): Target height of the lithophane in millimeters.max_thickness(float, default3.0): Maximum thickness in mm, corresponding to the blackest parts of the image.min_thickness(float, default0.5): Minimum thickness in mm, corresponding to the whitest parts of the image.frame_thick_mm(float, default1.0): The thickness (width) of the frame border in mm.frame_height_mm(float, default2.0): The height of the frame border in mm. If0, it matches the maximum height of the image.resolution(int, default5): Resolution in pixels per mm. Determines the detail level.enhance(bool, defaultFalse): IfTrue, applies contrast enhancement to the image before processing.shape(str, default"rect"): The shape of the lithophane. Supported values:"rect": Standard rectangular shape."circle": Circular shape."heart": Heart shape.
mesh.Mesh: Anumpy-stlmesh object representing the generated 3D model.
from lumina import flat_lithophane
# Generate a heart-shaped lithophane
mesh = flat_lithophane(
image_path="path/to/image.jpg",
shape="heart",
width_mm=100,
max_thickness=3.0,
min_thickness=0.5
)
# Save the mesh
mesh.save("my_heart_lithophane.stl")Generates a spiral betty (spiral art) image from an input image.
from lumina import generate_spiral_betty_png
def generate_spiral_betty_png(
image_path: str,
radius_mm: float = 100.0,
resolution: int = 5,
enhance: bool = False
) -> np.ndarray:image_path(str): Path to the input image file.radius_mm(float, default100.0): Target radius in mm.resolution(int, default5): Resolution in pixels per mm.enhance(bool, defaultFalse): Apply contrast enhancement before processing.
np.ndarray: A grayscale image with the spiral art pattern.
from lumina import generate_spiral_betty_png
import cv2
# Generate a spiral betty
spiral = generate_spiral_betty_png("path/to/portrait.jpg", radius_mm=50)
# Save the result
cv2.imwrite("spiral_output.png", spiral)