https://github.com/pierogis/pierogis Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories - + Security - * Team * Enterprise * Explore + Explore GitHub - Learn & contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Nonprofit - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} pierogis / pierogis * Watch 2 * Star 50 * Fork 0 image and animation processing framework AGPL-3.0 License 50 stars 0 forks Star Watch * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights main Switch branches/tags [ ] Branches Tags Nothing to show {{ refName }} default View all branches Nothing to show {{ refName }} default View all tags 4 branches 4 tags Go to file Code Clone HTTPS GitHub CLI [https://github.com/p] Use Git or checkout with SVN using the web URL. [gh repo clone pierog] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio If nothing happens, download the GitHub extension for Visual Studio and try again. Go back Latest commit @ksmoore17 ksmoore17 update readme to mention animations ... ecd033e Feb 20, 2021 update readme to mention animations ecd033e Git stats * 92 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .cargo refactor seasonings to always work on incoming pixels, add resize to ... Feb 16, 2021 .github/workflows reverse sorting groups, improve readme, add total frames count to output Feb 20, 2021 demo update input files and changelog, add chef test from txt file and pla... Feb 20, 2021 docs fix resize test with options Feb 20, 2021 src reverse sorting groups, improve readme, add total frames count to output Feb 20, 2021 tests fix resize test with options Feb 20, 2021 .gitignore add colors to threshold and quantize orders, add palette to quantize ... Feb 9, 2021 CHANGELOG.md fix resize test with options Feb 20, 2021 Cargo.lock add recipe generator to dish as multi pierogi processor, Feb 7, 2021 Cargo.toml refactor seasonings to always work on incoming pixels, add resize to ... Feb 16, 2021 LICENSE fix dir input handling Feb 2, 2021 MANIFEST.in fix naming pattern for no output provided Feb 3, 2021 README.md update readme to mention animations Feb 20, 2021 build_wheels.sh github actions working Jan 18, 2021 pyproject.toml add rust support with pyo3 and start quantization Jan 7, 2021 requirements.txt cleanup, add develop to ci test workflow Feb 19, 2021 setup.cfg change python package name to pyrogis Jan 17, 2021 setup.py refactor seasonings to always work on incoming pixels, add resize to ... Feb 16, 2021 View code README.md pierogis pierogis is a framework for image and animation processing. Ingredients that describe image processing functions can be assembled into recipes and used to cook an image or animation. pyrogis is a python library and cli tool implementing this framework. pip install pyrogis pyrogis chef input.png "sort; quantize" -o output.png sorted and quantized gnome * install * features * cli * package * acknowledgements * issues and contributing install install from a wheel with pip pip install pyrogis Depends on numpy and PIL. PIL requires some external C libraries for handling image files. You probably don't have to worry about this. If you do, try a conda installation. To build from source (either the repository or the sdist), you will need to install the rust stable toolchain and setuptools-rust. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh pip install setuptools-rust pip install . features * CLI - Use the CLI to cook a la carte recipes, or provide a recipe in a document * Animations - Animations (gifs and movies) can be cooked in one command * Extendable - Easy to create custom manipulations (see package) * Lazy Rendering - Render a manipulation after constructing your pipeline (see package) * Numpy or Rust backend - Image processing functions use Numpy for (python relative) fast operations. Some ingredients use compiled Rust for more speed. usage cli All of the cli commands look like this. pyrogis {order} {path} [-o output] [... order options] [--frames] [--fps fps] [--duration duration] [--no-optimize] order is one of * chef * sort * quantize * threshold * resize * plate The following options are used for each order (sort, quantize, etc.). A directory can be used for path, in which case the program will try to cook each file in the directory. If an output filename or dir is provided, it should match the expected output. In addition, each order or "menu item" has its own set of options. arg description default valid sort, quantize, order order type / menu item to cook required chef, threshold, plate, resize path path to input media required dir, image, animation depends -o,--output name of the output directory on str or file output type if present, frames will be --frames cooked but not assembled into False flag animation (output is treated as dir) --fps fps to output an animation at 25 int (ignored if single frame) ms frame duration to output an --duration animation with (ignored if None int single frame, overrides duration) if present and output would be --no-optimize .gif, the gif is not optimized False int using pygifsicle If the input file is a directory or a movie file (anything animated), the output will be an animation as well. Artifact "cooked" folder will contain frames. If you don't understand what output type to expect from your command, don't provide output. sort sort pixels along an axis pyrogis sort ./input.jpg -l 50 -u 180 -t 1 Use -l and -u as lower and upper thresholds where contiguous groups of pixels with brightness outside of the thresholds are sorted. If only lower is provided, upper is set to 255. If only upper is provided, lower is set to 0. sorted gnome arg description default valid -l, pixels with intensity below this 64 0-255 --lower-threshold value are sorted -u, pixels with intensity above this 180 0-255 --upper-threshold value are sorted -t, --turns number of clockwise turns from 0 0-3 sorting bottom to top --ccw if provided, turns will be applied False flag counter-clockwise quantize quantize an image to a smaller set of colors quantized gnome pyrogis quantize input.jpg -c aaaaaa 43ad32 696969 --repeats 3 --iterations 3 # or pyrogis quantize input.jpg -n 16 --repeats 3 --iterations 3 Wraps rscolorq) in python. Thank you to the author of that package. arg description default valid -c, --colors hex colors to base palette on None int (palette size ignored) -n, number of colors in the palette to 8 int --palette_size cluster for --repeats number of times to repeat a 1 int temperature for DA --iterations number of times to repeat an 1 int iteration of a coarseness level --initial-temp initial temp to use in DA for 1 float optimization --final-temp final temp to use in DA for 0.001 float optimization --dithering-level relative dithering level (use .5-1.5) 0.8 float chef parse text for a recipe sorted and quantized gnome .txt files and quoted strings can describe a series of CLI recipes, piped from one to the next. pyrogis chef ./input.jpg "sort -u 100; quantize" # or pyrogis chef ./input.jpg recipe.txt recipe.txt sort -u 100; quantize arg description default valid recipe path to json or txt file to use as a recipe recipe.txt str threshold pixels included or excluded based on brightness threshold gnome Pixels with brightness outside of the thresholds provided become "included". Pixels within the thresholds become "excluded" (greater than lower, but less than upper). By default, included means replaced with white, excluded with black. sort uses this under the hood. pyrogis threshold ./input.jpg -u 150 -l 20 arg description default valid -u,--upper-threshold pixels above this value are white 180 int -l,--lower-threshold pixels below this value are white 64 int --include hex color to substitute for white ffffff str --exclude hex color to substitute for black 000000 str resize change the size of an image with options to maintain aspect ratio Provide one of width or height and the other will scale appropriately. Use of both height and width is probably redundant and will stretch the image if the ratio is not the same. scale can also be provided as an alternative or alongside height/ width. By default, a nearest neighbor scaling "filter" is used. When scaling up, nearest neighbor preserves the pixelated look if scale is a whole number (or width/height are provided as multiples of the current size). See PIL documentation on filters When used in a chef recipe, scaling down at the beginning of a recipe and up at the end can lead to cool (and faster) results. pyrogis resize ./input.jpg -s .25 pyrogis resize ./input.jpg -s 4 # or using exact dimension (aspect ratio maintained) pyrogis resize ./input.jpg -h 200 pyrogis resize ./input.jpg -h 800 arg description default valid --width width to resize to None int --height height to resize to None int --scale scale multiplier for 1 float width and height --filter a filter to be used nearest nearest, bicubic, bilinear, with resizing box, hamming, lanczos plate bundle a directory of frames into an animation When --frames flag is present for a cook operation on an animation file (gif, mp4, etc.), the output is left in a directory and not compiled into a movie file. plate can be used to take this input directory and compile into a movie file. Doesn't work as an ingredient in chef recipe. duration will override fps. The options for this can be provided to any order if the output would be an animation. pyrogis plate ./cooked --fps 50 arg description default valid --fps fps to output an animation at (ignored if 25 int single frame) ms frame duration to output an animation --duration with (ignored if single frame, overrides None int duration) --no-optimize if present and output would be .gif, the False int gif is not optimized using pygifsicle package "pierogis is the name of the framework; pyrogis is the name of the python package and cli tool" - a wise man import pyrogis Docs are automatically generated by pdoc The created files can be found in this repository in the docs folder acknowledgements The original python pixelsort package inspired this package. While the underlying algorithm of that package and of sort in this one is supposed to be functionally the same, details of the implementation may differ, and it makes up just part of this package. The quantizing algorithm used in this package is implemented by rscolorq, which is a port of scolorq, itself an implementation of Spatial Color Quantization. issues and contributing When you encounter an error, there are some guidelines that will make it easier to help you: * Ensure that you are using the latest version of the package. It's early days so errors and updates will be frequent. Use pip uninstall pyrogis then pip install pyrogis --no-cache-dir to reinstall. * Provide the version of pyrogis that you are using in issues to rule that out. pip list -> pyrogis _._._ * Provide the traceback or error message if you can. * Provide your os and any other specific information relevant to how you are trying to use the package. * Provide the code or the cli command that triggered the error. * If the problem is visual: that can be more difficult to debug. Try to use an image hosting site if you want to share what you are seeing in an issue. * If you are getting different behavior than you expect: that could be an error or a feature too. * If your problem is with installation: try conda, preinstall numpy and pillow, install the rust toolchain, and start praying. There will be a website with a visual editor for this software so stay tuned. Hopefully all levels of skills can use this package. Any form of contributing is appreciated; passive-aggressive semi-anonymous thumbs down is not appreciated. Everyone using and contributing to this package is doing it for the love of the game. Don't feel like your issue is too small to make an issue. Pull requests are always welcome and anyone interested in dev work should join the discord. Ingredient type algorithm/function suggestions can go in the ingredients channel. You can post your creations in the demo channel as well. About image and animation processing framework Topics pipeline pixel numpy glitch Resources Readme License AGPL-3.0 License Releases 4 tags Languages * Python 87.1% * Rust 12.3% * Shell 0.6% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.