Thermal swell pattern optimizer for Swell by Light
Project description
sbl-optimizer
Print pattern optimizer for Swell by Light (SbL).
SbL is an approachable technique for freeform raised textures on paper and other materials. SbL-Optimizer improves print patterns considering heat diffusion, making the resulting swell patterns better match the original images.
Optimization of the printed pattern results in a uniform temperature pattern closely matching the original pattern.
Table of Contents
Features
- Adaptive heat‐pattern optimization
Compensates for heat diffusion to produce raised textures that match your design. - Simple CLI
One‐command execution, with JSON‐based configuration and image input. - Built on Python
Uses NumPy, Pillow, and Matplotlib for computations and visualizations.
Installation
Install sbl-optimizer in two easy ways:
1. From PyPI
The simplest method—just pip:
pip install sbl-optimizer
2. From Source
Clone the repository and install locally:
git clone https://github.com/sosucat/sbl-optimizer.git
cd sbl-optimizer
pip install .
Requirements
Ensure you have Python and dependencies:
| Libraries | Versions |
|---|---|
| Python | 3.9 – 3.11 |
| NumPy | 1.24 - 2.2 |
| Pillow | 9.5 - 11.x |
| Matplotlib | 3.7 - 3.10 |
You can also install dependencies manually:
pip install numpy pillow matplotlib
Quick Start
-
If you are NOT in the project's root directory,
change the directory to the project's root directory:cd sbl_optimizer
Note: make sure you are at
sbl_optimizernotsbl_optimizer/sbl_optimizer -
Run the optimizer to generate an optimized pattern that accounts for heat diffusion:
python -m sbl_optimizer.main sample.jpg
-
Locate the generated optimized pattern
sample_opt.pdfin the project's root directory. -
Check the simulated heat distribution
sample_temperature.pngand swell patternsample_swell.png. -
Print the
sample_opt.pdfon paper, apply paste, and expose to a strong LED spotlight. Darker printed regions absorb more heat and swell. -
Try optimizing your own pattern.
python -m sbl_optimizer.main path/to/your_image
Configuration
Some parameters can be customized via a JSON file (default: config.json shipped with the package).
config.json
{
"swell_temperature": 145.0,
"light_power": 100.0,
"light_diameter": 0.06,
"alpha": 5e-07
}
| Key | Type | Description |
|---|---|---|
swell_temperature |
float | Target swelling temperature (°C). |
light_power |
float | Light source power (W). |
light_diameter |
float | Diameter of the light circle on paper (m). |
alpha |
float | Thermal diffusivity of paper (m²/s). |
To override defaults:
python -m sbl_optimizer.main <IMAGE> --config path/to/your_config.json
Command Line Interface
Usage
python -m sbl_optimizer.main [OPTIONS] <IMAGE>
Arguments
<IMAGE>
Path to the input image (JPG, PNG, etc.)
Options
| Option | Description |
|---|---|
-c, --config <FILE> |
Path to JSON config file |
-h, --help |
Show help message and exit |
Examples
-
Use default settings on
sample.jpgin the project's root directory.python -m sbl_optimizer.main sample.jpg
-
Use custom settings
python -m sbl_optimizer.main sample.jpg --config my_config.json
-
Save only error logs (disable plotting)
Editmain.py:- comment out
save_plots, uncommentsave_errors
- comment out
Output files (in same folder as input image sample.jpg):
| File | Description |
|---|---|
sample_opt.pdf |
Optimized pattern to be printed. |
sample_temperature.png |
Simulated temperature distribution. |
sample_swell.png |
Simulated swell pattern. |
Citation
If you use sbl-optimizer in your research or projects, please cite:\
@inproceedings{10.1145/3689050.3704420,
author = {Ichihashi, Sosuke and Howell, Noura and Oh, HyunJoo},
title = {Swell by Light: An Approachable Technique for Freeform Raised Textures},
year = {2025},
isbn = {9798400711978},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3689050.3704420},
doi = {10.1145/3689050.3704420},
booktitle = {Proceedings of the Nineteenth International Conference on Tangible, Embedded, and Embodied Interaction},
articleno = {45},
numpages = {16},
keywords = {2.5D fabrication, Personal fabrication, tactile rendering},
location = {Bordeaux / Talence, France},
series = {TEI '25}
}
See the paper and project page for more details.
Contributing
Contributions, issues, and feature requests are welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/foo) - Commit your changes (
git commit -am 'Add foo') - Push to the branch (
git push origin feature/foo) - Open a Pull Request
Please follow the existing code style and write tests for new functionality.
License
This project is licensed under the MIT License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sbl_optimizer-0.1.5.tar.gz.
File metadata
- Download URL: sbl_optimizer-0.1.5.tar.gz
- Upload date:
- Size: 110.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8067f433fa0d2cad2b2505eea0cc4a39d6e4f40ab6bb020bea671a4702b44b5a
|
|
| MD5 |
bc83e5d8b0db3607601127f5cd74b7a3
|
|
| BLAKE2b-256 |
a82d29bec2850e719f804cdcfb988165edfa5b8838b11654d2a982f1ec0de36c
|
File details
Details for the file sbl_optimizer-0.1.5-py3-none-any.whl.
File metadata
- Download URL: sbl_optimizer-0.1.5-py3-none-any.whl
- Upload date:
- Size: 108.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7065eec9bf7ee80a16d1766d1769a87283db5d220aee5ac111bd433cdf2907eb
|
|
| MD5 |
65da616199cbfb415114ef1612c77e7a
|
|
| BLAKE2b-256 |
93d465391cab3bfa8af0c2c1ac40fb95d3482903fb69b946b0554e842a5adf50
|