Reputation: 11
I am using pycasso to scramble an image and was wondering does anybody know haw to input rectangles instead of squares for the slice_size
from pycasso import Canvas
img = 'input.jpeg'
slice_size = 200
seed = 'seed'
pycasso = Canvas(img, slice_size, seed)
pycasso.export(mode='scramble', path='image_output.png')
Thank you in advance
Upvotes: 1
Views: 134
Reputation: 17594
That does not seem to be an option with the current implementation:
https://github.com/catsital/pycasso/blob/27f014d7a57cde03804943ecab948d409cd70715/pycasso/unscramble.py#L13-L20
class Canvas:
def __init__(self, img, slice_size, seed=None):
self.img = Image.open(img)
self.slice_size = abs(slice_size)
self.seed = seed
self.canvas = Image.new(mode="RGBA",
size=(self.img_width, self.img_height),
color=(255,255,255))
In the constructor for the class Canvas
we have the variable slice_size
and that will be used for both vertical and horizontal slices ... that is all we have at the moment.
However it should not be too difficult to modify that code to allow two parameters in the constructor, the variable slice_size
it's just used in a few places:
https://github.com/catsital/pycasso/search?q=slice_size
Just look at each and determine if is vertical or horizontal slices and replace accordingly...
You can make the change yourself and submit a Pull Request (PR) or just open a new issue:
https://github.com/catsital/pycasso/issues/new
Explain in detail why you need this and the owner should see the benefits
Upvotes: 0