Skip to content

Commit

Permalink
version: bump to 2.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Dynamos committed Jan 9, 2025
1 parent d41f7b8 commit dcc50a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ for color in vars(MaterialDynamicColors).keys():
# Pillow is required to open image to array of pixels
from PIL import Image
# C++ QuantizeCelebi
from materialyoucolor.quantize import QuantizeCelebi, StbLoadImage
from materialyoucolor.quantize import QuantizeCelebi, ImageQuantizeCelebi
# Material You's default scoring of colors
from materialyoucolor.score.score import Score

Expand All @@ -143,17 +143,17 @@ image = Image.open("path_to_some_image.jpg")
pixel_len = image.width * image.height
image_data = image.getdata()

# Alternate method
# image_data = StbLoadImage("path_to_some_image.jpg")
# Warning: This method is slower and much more resource intensive
# (eats too much ram) so use it with caution

# Quality 1 means skip no pixels
quality = 1
pixel_array = [image_data[_] for _ in range(0, pixel_len, quality)]

# Run algorithm
result = QuantizeCelebi(pixel_array, 128) # 128 -> number desired colors, default 128

# Alternate C++ method
# this is generally faster, but gives less control over image
# result = ImageQuantizeCelebi("path_to_some_image.jpg", quality, 128)

print(result)
# {4278722365: 2320, 4278723396: 2405, 4278723657: 2366,...
# result is a dict where key is
Expand Down
2 changes: 1 addition & 1 deletion materialyoucolor/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.9"
__version__ = "2.0.10"

0 comments on commit dcc50a9

Please sign in to comment.