gaugo87 / PIXEstL

A program for creating color lithophanies and pixel images
MIT License
60 stars 10 forks source link

PIXEstL

A program for creating color lithophane and pixel images. The program relies on a color palette that can be customized by adding its own filaments. This allows for the creation of lithophanes with an infinite variety of filaments.

The filaments can be added to the palette in two ways:

By adding the color of the raw filament (for creating pixel art images). By adding the chromatic characteristics of the different layers of your filament (for creating lithophanes).

For example for lithophanes, in addition to the usual Cyan, Magenta, and Yellow filaments, the palette allows for the addition of Black (for achieving deep black), or simply adding lighter CMY shades (in addition to the usual ones) to enrich the color palette.

Usage

usage: PIXEstL
 -b,--colorPixelLayerThickness <arg>   Thickness of each color pixel layer (mm). Default: 0.1
 -c,--colorNumber <arg>                Maximum number of color number by layer. Default: no limits
 -C,--curve <arg>                      Curve parameter. Default: no curve
 -cW,--colorPixelWidth <arg>           Width of color pixels (mm). Default: 0.8
 -d,--colorDistanceComputation <arg>   Method for pixel color distance computation [RGB,CIELab]. Default: CIELab
 -F,--pixelCreationMethod <arg>        Method for pixel creation [ADDITIVE,FULL]. Default: ADDITIVE
 -f,--plateThickness <arg>             Thickness of the plate (mm). Default: 0.2
 -H,--destImageHeight <arg>            Height of the destination image (mm).
 -i,--srcImagePath <arg>               Path to the source image.
 -l,--colorLayerNumber <arg>           Number of color pixel layers. Default: 5
 -M,--textureMaxThickness <arg>        Maximum thickness of the texture (mm). Default: 2.5
 -m,--textureMinThickness <arg>        Minimum  thickness of the texture (mm). Default: 0.2
 -n,--layerThreadMaxNumber <arg>       Maximum number of threads for layers generation. Default: 1 by STL layer
 -N,--rowThreadMaxNumber <arg>         Number of threads for rows generation. Default: number of cores available
 -o,--destZipPath <arg>                Destination ZIP file path. Default: <-image>.zip
 -p,--palettePath <arg>                Path to the palette file.
 -t,--layerThreadTimeout <arg>         Timeout for layer threads (second). Default: 300
 -T,--rowThreadTimeout <arg>           Timeout for row threads (second). Default : 120
 -tW,--texturePixelWidth <arg>         Width of texture pixels (mm). Default: 0.25
 -w,--destImageWidth <arg>             Width of the destination image (mm).
 -Y,--lowMemory                        Low Memory mode (Use temp files to store polygons)
 -X,--debug                            Debug mode
 -z,--colorLayer <arg>                 Color layers will generate or not. Default : true
 -Z,--textureLayer <arg>               Texture layers will generate or not. Default : true

Quick Start (to quickly test the program)

A zip file has been generated (Cafe_Terrace_at_Night.zip) ? Congratulations! The program works!
Open the generated zip file, to see the result...

Then :

YouTube tutorial channel (in French)

PIXEstL

Examples of results

Color lithophanes

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 130 -d RGB -i Cafe_Terrace_at_Night.jpg
Terrace_at_Night
java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 150 -i mem.png
memory_geisha
java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 150 -i starwars.jpg
starwars

Color lithophane with small texture layer

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 130 -d RGB -M 1.4 -i rainbow_infinity.png
infinity

Lithophane with only texture layer

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -M 3 -w 150 -z false -i tsunami_Hokusai.jpg
tsunami_hokusai

Lithophane of a face with underexposure and overexposure to light

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 100 -i Marilyn.jpg
marilyn.jpg

Lithophane with the new default color distance computation (CIELab)

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 150 -M 1.5 -i Petals.jpg
petals.jpg

Lithophane from an image with transparency in the background

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 400 -d RGB -M 2 -i butterfly.png 
marilyn.jpg

Lithophanes in black and white, with 3 filaments (Black, White and Silver)

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 150 -cW 0.4 -i vegeta.jpg
vegeta

Lithophanes in 7 filaments with only 1 AMS (pool of 4 filaments)

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 100 -M 1.7 -l 4 -c 4 -i Leon.png 
Leon_1AMS.jpg
java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 100 -M 1.7 -l 4 -c 4 -i Cafe_Terrace_at_Night.jpg
Terrace_at_Night_1AMS

Pixel Art image (with only color layers + FULL colors)

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -w 200 -c 8 -F FULL -Z false -cW 2 -l 2 -f 1 -d RGB -i tsunami_Hokusai.jpg
tsunami_hokusai_pixel

Others lithophanes

dolphin deku halloween_globe hello_kitty marvel ryan.jpg ahsoka.jpg

The palette

The palette is composed of a JSON structure that gathers all the filaments you have.

"#0086D6":
{
  "name": "Cyan[PLA Basic]",
  "active": true,
  "layers": {
    "5": {
      "H": 202.4,
      "S": 95,
      "L": 48
    },
    [...]
    "2": {
      "H": 202.4,
      "S": 95,
      "L": 69.6
    },
    "1": {
      "hexcode": "#92D6FD"
    }
  }
}

The fields #XXXXXX, name, and active are mandatory. They allow for creating pixel art images.
The layers field is required for the filament to be used in creating color lithophanes through color addition. The code #FFFFFF filament is mandatory to be used in creating color lithophanes through color addition (but th HSL values can be changed).

Palette composed of BambuLab filaments, with 0.10mm layers : filament-palette-0.10mm.json

How to calculate the chromatic properties of the layers of your filament

  1. Create squares in your slicer with the desired thickness, representing the different desired layers. For example, if you are working with 0.1mm layers, create a square with a thickness of 0.1mm, another one with 0.2mm, then 0.3mm, 0.4mm, and 0.5mm.
    A sample of calibration square in 0.1mm is present here
  2. Print the squares using the appropriate filament.

    And the appropriate print settings (infill 100%. layer height and first layer height at 0.1/0.12, etc. )

    Note: Ironing is recommended to achieve a smoother and more uniform surface. This makes it easier to take measurements.

  3. Place the squares in front of a neutral light source and take photos of them.
  4. Open with your favorite editor the photos (e.g., "Paint") and use the color picker tool to extract the color.
  5. Optionally, convert the hexadecimal color to HSL if your editing software does not provide HSL values (e.g., use a tool like https://convertacolor.com/).
  6. Enter these HSL values for each layer in the palette.
    "2": {
      "H": 199,
      "S": 100,
      "L": 64.1
    },

    or enter the hexcode for each layer in the palette.

    "2": {
      "hexcode": "#48C5FF"
    },

Recommended parameters for a 0.2mm nozzle (default)

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -i ...

Recommended parameters for a 0.4mm nozzle

java -jar PIXEstL.jar -p filament-palette-0.10mm.json -f 0.24 -b 0.12 -i ...

Recommended parameters for a print in 7 colors with only an AMS with 4 colors

java -jar PIXEstL.jar -p filament-palette-0.10mm.json ... -c 4 -l 4

Execution result

Running the program generates a zip file that contains:

Example :

Slicing procedure

Print settings

Example with Bambu Studio

Slicing procedure for a print in 7 colors with only an AMS

Generate the lithophane in "7 colors with an AMS" mode.

java -jar PIXEstL.jar -p filament-palette-0.10mm.json ... -c 4 -l 4

Follow the instructions described in the section [Slicing procedure](##Slicing procedure). Open the file "instructions.txt" to identify the filament changes to be made at the indicated layer. Ex:

Layer[0.0] :Cyan[PLA Basic], Magenta[PLA Basic], Yellow[PLA Basic], White[PLA Basic]
Layer[0.7] :Cyan[PLA Basic]-->Matte Ice Blue[PLA Matte], Magenta[PLA Basic]-->Beige[PLA Basic], Yellow[PLA Basic]-->Matte Sakura Pink[PLA Matte]

In this example, and because my layer heights are 0.1mm, the filament changes occur at layer 7. At layer 7, you will need to change:

Two things need to be done in the slicer to prepare for the filament change:

During printing, once the pause is triggered, do the filament changes as indicated in the "instructions.txt" file. If a color filament is "stuck," change all the filaments you can, then resume the print, and change the filament once the printer switches to the white filament (Thanks to the modification of the sequence at layer 7, the printer should immediately load the white filament and thus release the last blocked filament).

Binary generation

Prerequisites

Compilation

cd PIXEstL
set JAVA_HOME=C:\Program Files\Java\jdk-20
set MAVEN_HOME=C:\Program Files\apache-maven-3.3.1
mvn clean install