r/generative • • Apr 25 '20

[Processing 3] 50 Lines

Post image
515 Upvotes

41 comments sorted by

View all comments

Show parent comment

1

u/d_ynamic Apr 26 '20

The map(...) function in this tweaked source code is missing, and it's a little bit asymmetrical (there is an out-of-bounds wave on the topmost of the output image, where in the bottommost, there is none). Nice rework on the code by the way. :)

2

u/reality_boy Apr 27 '20

Your right on the asymmetry!

I took out the map as a first step to allowing any sized source image. My new code sizes the output canvas to the same aspect ratio as the input image and used bilinear interpolation to allow for better up or down sampling of the source image.

The trick is to add a settings() function. You can then open the source image before calling size() on the output canvas. If you do the size in the setup() function it must be the first call.

I have been wanting to jump into generative art for a while. Thanks for the inspiration!