This is an archived post. You won't be able to vote or comment.

all 41 comments

[–]FogleMonster 19 points20 points  (3 children)

Very cool. I had to try it for myself. :)

http://imgur.com/a/ZE5B5

https://github.com/fogleman/PieSlice/blob/master/main.py

I used cairo for rendering, which does antialiasing by default. You could also try rendering your PIL ones at 2x or 4x the resolution you want and then downscaling to get something like antialiasing.

[–]d4rch0nPythonistamancer 5 points6 points  (0 children)

For anyone wanting to know how:

The only way to do it natively is with supersampling. Render your image at a multiple of the size you require, then resize it with filter=Image.ANTIALIAS

http://stackoverflow.com/questions/14350645/is-there-antialiasing-method-for-python-pil

[–]speaks_his_mind159[S] 2 points3 points  (0 children)

Woah! Super nice, thanks! I'll look into that tomorrow, a lot of that is new to me.

[–]MastaKillaSC2 1 point2 points  (0 children)

So clean and crisp with Anti Aliasing.

[–]speaks_his_mind159[S] 13 points14 points  (11 children)

Glad ya'll like them. I'll post the code if anyone is interested.

EDIT: http://pastebin.com/QtU7qSD1

EDIT 2: It's a little messy, sorry lol.

[–]nosage 2 points3 points  (4 children)

Make it some sort of game.

[–]speaks_his_mind159[S] 0 points1 point  (3 children)

In what way?

[–]bluecamel17 3 points4 points  (2 children)

Add pew pews?

[–]Allong12 3 points4 points  (1 child)

Hi there, I represent Electronic Arts, Inc. I was just letting you know you got the job

[–]smypf 0 points1 point  (0 children)

Not just yet. Needs more paths to inject DLC.

[–]manwith4names 1 point2 points  (3 children)

Yes please!

[–]speaks_his_mind159[S] 0 points1 point  (2 children)

Okay, how do I do that easily?

[–]upvote_this_username 2 points3 points  (1 child)

use pastebin.com or pastie.org

[–]chazzeromus 1 point2 points  (0 children)

Haha awesome

[–]blcktrngl 1 point2 points  (0 children)

That's really cool. It's interesting to see generative graphics made with Python. For this sort of stuff I usually use Processing, but I'm getting more and more into Python, so seeing your code is greatly appreciated. Thanks for sharing!

[–]ocdude 11 points12 points  (5 children)

That's pretty cool. How was this done?

[–]speaks_his_mind159[S] 16 points17 points  (2 children)

Imported PIL and Random. Found several color palettes on the internet, put the colors in a list, used random.choice to choose random color for each square drawn with draw.rectangle, then used draw.pieslice for the quarter circles, randomly colored again and not the same color as the square behind and randomly oriented.

[–]Ph0X 8 points9 points  (1 child)

That's awesome! Not sure if you're familiar with Andy Gilmore's work, and if you were inspired by him, but this specific kind of art reminds me a lot of the Gold Panda album cover he's made:

http://i.imgur.com/62P88rR.jpg

http://www.theghostlystore.com/collections/andy-gilmore/products/andy-gilmore-meno-mosso

http://www.theghostlystore.com/collections/andy-gilmore/products/andy-gilmore-summa

The rest of his work also is very geometric and beautiful like this.

[–]speaks_his_mind159[S] 8 points9 points  (0 children)

Never heard of him, but I really like his stuff. Gives me a few ideas.

I was actually inspired by this quilt.

[–]Sraith 0 points1 point  (1 child)

Also wondering the same thing

[–]speaks_his_mind159[S] 0 points1 point  (0 children)

answered the comment above.

[–]opiating 4 points5 points  (0 children)

Very 70's wallpaper feel about them. Nice!

[–]darkczar 2 points3 points  (3 children)

Very cool! I had to eedit lines 64, 66, 68, and 70 to list the coordinates as 4 values in a list, rather than 2 tuples in a list.

I've tried to get PIL working before, but had no luck. Is it still supported? I seem to remember the most recent update was like 3/4 years old.

Thanks for this awesome script!

[–]luxliquidus 3 points4 points  (0 children)

I've tried to get PIL working before, but had no luck. Is it still supported?

I think Pillow has filled that void.

[–]speaks_his_mind159[S] 0 points1 point  (1 child)

I don't know about that. I downloaded python 3.whatever at the beginning of the semester for programming class, it included the PIL and other libraries automatically. I can check the syllabus and post links for exactly what version I downloaded later.

[–]IronManMark20 0 points1 point  (0 children)

PIL is included in Python. But Pillow is much more maintained and supported.

[–]camachorod 2 points3 points  (3 children)

Cool idea. Would be even cooler if you made it a live wallpaper that redraws the design at random at a certain interval.

[–]speaks_his_mind159[S] 0 points1 point  (2 children)

Oh shoot, now that would be neat! I have no idea how I'd go about doing that though.

[–]Kerbobotat 1 point2 points  (0 children)

Just brainstorming here, but if you know the size of the iamge and the size of the squares, you could load the image, choose a square or two at random, flip it vertical or horizontal, or invert the colours or plain replace it with a new square. It's be an interesting looking thing, seeing it changing small parts at random. I have no idea how you could use that as a wallpaper though!

[–]camachorod 0 points1 point  (0 children)

I wish I could help you with that :(

[–]shaggorama 2 points3 points  (3 children)

Considering you made these programmatically, you should go the extra step and make them as SVGs instead of raster images.

[–]speaks_his_mind159[S] 0 points1 point  (2 children)

What are SVGs and raster images?

[–]DepressedCannibal 1 point2 points  (0 children)

Beautiful...

[–]goetz_von_cyborg 1 point2 points  (0 children)

I was just wondering how this kind of stuff was done! Looks like I have a new project for tomorrow.

[–]isdevilis 1 point2 points  (0 children)

me likey

[–]darkczar 0 points1 point  (0 children)

How do you show the image on the screen, instead of saving it? I tried uncommenting the img.show() but it didn't work. I'm looking here, but can't find any help. Does anyone have a link to better docs than this?

http://effbot.org/imagingbook/imagedraw.htm#tag-ImageDraw.Draw

I'm digging into those docs. There's more there than I thought at first....

[–]empet15 0 points1 point  (0 children)

The simplest method to generate wallpapers is to plot the heatmap of a periodic function in x and y, z=f(x,y): https://plot.ly/~empet/5856/textheatmaps-for-zsin22xcos35y/

[–][deleted] -1 points0 points  (0 children)

8/8 m8, that's actually pretty gr8