Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mask is not rotated and potentially gives errors when rotate and mask are both specified #19

Closed
abetusk opened this issue Oct 30, 2019 · 1 comment

Comments

@abetusk
Copy link
Contributor

abetusk commented Oct 30, 2019

I get the following error when trying to use the mask on a rotated pixel sort image:

$ python3 pixelsort.py examples/image.jpg -i random -a 120 -c 20 -m examples/mask.png 
Traceback (most recent call last):
  File "pixelsort.py", line 81, in <module>
    main(parse_args())
  File "pixelsort.py", line 33, in main
    pixels = get_pixels(data, mask, input_img.size)
  File "pixelsort.py", line 62, in get_pixels
    if not (mask and mask[x, y] == constants.black_pixel):
IndexError: image index out of range

After adding the following line:

    mask = Image.open(args["mask"]).convert('RGBA').rotate(args["angle"], expand=True).load() if args["mask"] else None

I get the following image as I would expect:

3vxZ7

I'll submit a PR with the fix unless you get to it before I do.

@abetusk abetusk changed the title Mask is not rotate and potentially gives errors when rotate is specified Mask is not rotated and potentially gives errors when rotate and mask are both specified Oct 30, 2019
abetusk added a commit to abetusk/pixelsort that referenced this issue Oct 30, 2019
* rotates mask
* takes away spurious 'f' characters in argparse file
satyarth pushed a commit that referenced this issue Oct 31, 2019
* rotates mask
* takes away spurious 'f' characters in argparse file
@satyarth
Copy link
Owner

fixed in 3444f60

BernardZhao added a commit that referenced this issue Dec 29, 2019
* resolves issue #19 and #18

* rotates mask
* takes away spurious 'f' characters in argparse file

* corrected formating (converted from f-string to other string format)

* Fix syntax warning (#22)

* Modularity changes

* Some small formatting fixes

* Packaged code

* Packaged code

* Some cleanup

* Import tweak

* More updates and fixes

* More fixes

* Updated README.md

* Caught up to master

* Fixed packaging issues, some general cleanup

* Formatting fixes

* Fixed accidental requirements change

* Forgot these files

* Fix cropping bug

* Fixed sorting randomness bug

* Fixed release version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants