Open Rel-Oiv opened 2 years ago
I found out what caused the errors. I was using an image with RGBA color mode . To not give the error, the image color mode must be "gray". I used the function convert( 'L' ) to transform the image to "gray" ('L' is 8-bit pixels, black and white, as per pillow documentation), form pillow library (this halftone library already uses it). Bear in mind, function convert( 'L' ) transform the alpha (transparency) into black color.
For who is interested, here is the code of the code from readme file with the addition of convert( 'L' ):
import halftone as ht
import PIL.Image
inputImage = 'ht-test.png' # Path to the image that will be halftoned
outputImage = 'bar.png' # Where the image will be exported as a file
img = PIL.Image.open(inputImage)
img = img.convert('L')
halftoned = ht.halftone(img, ht.euclid_dot(spacing=8, angle=30))
halftoned.save(outputImage)
Hello,
I ran the code that is present in the githup description and it throws an error:
(debugger shows that img_shape tuplet has 3 items)
I added a variable in the function
def evaluate_2d_func(img_shape, fn):
after h variable inw, h = img_shape
, to have 3 variables out of the tuplet, so it wouldn't throw an error.But know throws a different error: