Closed ITCave closed 9 years ago
I will merge this soon, though you may need to make some changes I've been working on the project and fixing bits before it got a lot of attention on /r/python or where ever most of you came from. I'm almost done and will look through the merges after I'm done.
/r/python it is. And sure - take your time ;) The core change: I made use of image.point() instead of image.load() ( it's way faster - I dropped from 2.7 seconds fo like 0.7 with 40x40 brick image. The efficiency raises exponentially with bigger grids.
Smaller tweak is to copy "brickImage" instead of loading it each time (I've seen similiar pulls on the list). The rest is probably your "work in progress" (like parameters etc.)
Anyways, thanks for a great inspiration - one LEGO poster is already ordered ;)
Not exactly sure how to merge and fix conflicts without screwing up again, so I just manually added it and will close this. I am very thankful that you showed me this, the entire script is so much faster. Also there was a built in copy function. What picture is the lego poster? I never expected this project to get this much attention. Its just great to hear a lot of people giving great feedback.
Could you explain the new applyEffect to me?
Sure :)
Sorry, I was pretty busy this weekend. So:
.split() - function splits image into separate channels ( Red Green Blue)
I use .point() to iterate throught each pixel on each channel and apply same function you did (colorize) via lambda (if > 100 , if < -100 else...) - this is the clue, it is way faster than loading color arrays via .load()
Than I apply changed sequence of colors to each channel (.paste()) and .merge() them together with the same .mode the base image had.
You also asked what picture I sent to print out :]
http://imgur.com/WDBhWzD
(small gift for my GF, hope she will like it - it's our dog )
I the next few days I will probably have some spare time, so I'll make some more commits
Have fun!
Ok, is there a way to have one channel that includes rgb? I was wondering because I wanted to adjust the values according to luminosity in hsl, because if the color is too dark/bright it would drown the shadows/highlights.
Dropped colorize(), overUnder() in favor of optimized applyEffect function
Rewritten makeLegoBrick to copy brick image object.
Applied width, height arguments in main() to affect the final image size.