Added PixelArtAddDitherPattern node. #12
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Didn't hear from you right away so I implemented dithering as well, however through a new
PixelArtAddDitherPattern
node:The node adds dither pattern to the image RGB values, so any color quantizer after the node achieves a dither look. It's modular and flexible, for example one could use the built-in
Quantize
node for dithering. The node also adds support for custom dither patterns (via input mask), and the classic 45-degree halftone pattern.Here's manga'esque halftoning look using built-in
![Elf_00039_](https://private-user-images.githubusercontent.com/5467191/280282718-21016912-f5cc-47c2-aab5-cf4b7ea4461b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2NjA1MDEsIm5iZiI6MTcyNTY2MDIwMSwicGF0aCI6Ii81NDY3MTkxLzI4MDI4MjcxOC0yMTAxNjkxMi1mNWNjLTQ3YzItYWFiNS1jZjRiN2VhNDQ2MWIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDZUMjIwMzIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OGRlNDkwMGU1N2ZkY2Q0YjI2MWVlODFkZTZjNmMxYjIzZTgyZjJjYjgwNDFkZDJiOTZmYTkwYjY4NmRjNzRmZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.2dYnNDdTw4krPAnJax5GMIhKF70dLhV7Fa-8EV084as)
Quantize
node:The
amount
option is a multiplier for the effect. Generallyamount = 1 / num_colors
is a good starting point.Bayer pattern example:
![ComfyUI_00001_](https://private-user-images.githubusercontent.com/5467191/280274177-6132147a-b459-4756-986e-9ed088e12c92.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2NjA1MDEsIm5iZiI6MTcyNTY2MDIwMSwicGF0aCI6Ii81NDY3MTkxLzI4MDI3NDE3Ny02MTMyMTQ3YS1iNDU5LTQ3NTYtOTg2ZS05ZWQwODhlMTJjOTIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDZUMjIwMzIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTE0OTNkOTY5NzQzYmIwMGI4MTg0MTk4N2VlOWJmZDdjMGMyYjI3MjQzN2YwNjc3YzU4MWQzYTAwZjg5ZGYwYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.Zz_O_VdwurLQrjcFS2U0uiUZDkThmUFSJFivsq3y_0w)
Blue noise (custom pattern):
![ComfyUI_00002_](https://private-user-images.githubusercontent.com/5467191/280274280-d41967cf-96c1-41ed-91d5-79c30183b788.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2NjA1MDEsIm5iZiI6MTcyNTY2MDIwMSwicGF0aCI6Ii81NDY3MTkxLzI4MDI3NDI4MC1kNDE5NjdjZi05NmMxLTQxZWQtOTFkNS03OWMzMDE4M2I3ODgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDZUMjIwMzIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWVjMGU5NTkzNjM4MDVlYjAwNGQyNzIyNDM3MzgwYjJhNmE5OTRmNTRhNTE2YjBkMjBhOTQyNjk4ODYyYjVkYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.7ehdiOo9YuakZ5GFtVDg_iL5goA5xe0AgCilYh-pFlU)
Game Boy Camera'esque look:
![ComfyUI_00003_](https://private-user-images.githubusercontent.com/5467191/280276083-c3d21f45-73c3-4a67-b69b-551d87c9966b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2NjA1MDEsIm5iZiI6MTcyNTY2MDIwMSwicGF0aCI6Ii81NDY3MTkxLzI4MDI3NjA4My1jM2QyMWY0NS03M2MzLTRhNjctYjY5Yi01NTFkODdjOTk2NmIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDZUMjIwMzIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjIxOWZlNDEwOTYxOGVjNTExZDE4Y2UwZmQzMzgzNjI4MTI1ZjdhZjAyNGExMWE5MTdjNjg4ZGM2MjM1MTY3NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.axYpa9KvJzZE5u7S_UuMhL1PS3ZFeUdKCOS-QDovt0A)
(Blue noise mask image:)
![blue-noise-16x16](https://private-user-images.githubusercontent.com/5467191/280277676-dad06a48-abd4-4b4a-b817-ebeb8b2d93b8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2NjA1MDEsIm5iZiI6MTcyNTY2MDIwMSwicGF0aCI6Ii81NDY3MTkxLzI4MDI3NzY3Ni1kYWQwNmE0OC1hYmQ0LTRiNGEtYjgxNy1lYmViOGIyZDkzYjgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDkwNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA5MDZUMjIwMzIxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTFlMzU5MjdiMzE3M2E5YTViNDhlN2VkYzlhYjliMmM5MjJkNTVkM2I3Njg0ZTJkNTg4NjlhZWMxZWVkMjc2NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.jTT6F7K0M4obJZLNCKMA_jpCwFULLBTxPxKWXrOdrCA)
(Workflows included in the images.)