Giter VIP home page Giter VIP logo

prusa-thumbnail-generator's Introduction

Prusa Thumbnail Generator

A simple python script that transforms a .png into a thumbnail for Prusa GCode.

Usage

Install dependecies

This script's only dependency is Pillow. You can easily install it using pip :

pip install Pillow

Or if pip is not in your PATH :

python3 -m pip install Pillow

Get the code

You can either pull the repository :

git clone https://github.com/l-eg116/prusa-thumbnail-generator.git
cd prusa-thumbnail-generator

Or just download the python file :

wget https://raw.githubusercontent.com/l-eg116/prusa-thumbnail-generator/main/generate-thumbnail.py
chmod +x generate-thumbnail.py

Run the code

To run the script, use :

./generate-thumbnail.py [-h] [-m] [-s [SIZE]] [--crop] input [output]

or

python3 generate-thumbnail.py [-h] [-m] [-s [SIZE]] [--crop] input [output]

Arguments and flags

Get this list in your command line with ./generate-thumbnail.py -h or ./generate-thumbnail.py --help.

input

The .png file that you want to make a thumbnail of.

output

Destination of generated thumnail, stdout by default. Unless --merge is set, the thumbnail will be appended to the file.

--merge, -m

If this flag is set, existing thumbnail data in output will be replaced with the one generated. Only thumbnails with the same dimensions will be replaced. If no thumbnail is found, new thumbnail will be prepended to the file.

This is usefull for changing thumbnails of GCode previously generated by the PrusaSlicer.

--size [SIZE], -s [SIZE]

SIZE: <width>x<height> or keep

Specifies the size of the generated thumbnail, 220x124 by default. Use keep to disable image resizing. 220x124 corresponds to the thumbnail size for Prusa Mini and Mini+ 3D printers.

--crop

If this flag is set, the image will be cropped to target aspect ratio before being resized to prevent stretching.

Disclaimers

Python version

This project was tested with Python 3.10.12 and should be able to run with any version >= 3.6.

Testing

The thumbnails generated where tested on Prusa Mini and Mini+ 3D printers. The format should be the same for other Prusa printers (ie base 64 encoded PNGs) but I can't say for sure. If you have any input on this feel free.

prusa-thumbnail-generator's People

Contributors

l-eg116 avatar

Stargazers

CodySen avatar Yann M. Vidamment avatar Charles DUVAL avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.