ClayFlannigan / halftone

Generate CMYK halftone images
Apache License 2.0
30 stars 7 forks source link

Not working with NumPy 1.20.1 #3

Open shankhya opened 3 years ago

shankhya commented 3 years ago

I tried halftoning an image using Halftone.py using python halftone.py -l Banff.jpg (-l command for halftoning the images) but the following errors occurred

(Haltone) C:\Users\shank\Documents\Documents\Haltone>python halftone.py -l Banff.jpg Traceback (most recent call last): File "halftone.py", line 219, in CMYK = halftone(CMYK, args.size, args.angles, args.fill, args.sharpness) File "halftone.py", line 111, in halftone tiled_kernel = np.tile(kernel, num_kernels) File "", line 5, in tile File "C:\Users\shank\anaconda3\envs\Haltone\lib\site-packages\numpy\lib\shape_base.py", line 1260, in tile return c.reshape(shape_out) TypeError: 'numpy.float64' object cannot be interpreted as an integer

If I do not use the -l command, then the resultant images are not halftoned.

Please help me solve this issue.

Thanks, Shankhya.

FoamyGuy commented 1 year ago

I am hitting this problem too. I tried downgrading to a lower numpy, but was unable to get that working.

Did anyone ever find a fix for this?

FoamyGuy commented 1 year ago

There are some values that modern versions of numpy is expecting to be ints but I guess sometime in the past they may have allowed floats.

I was able to work around this issue by adding some int() casting in a few places. I'm not positive if this is the correct solution, but I am now able to get the halftone effect working on my images.