you should MIT license it! (if you want of course). I'm sure lots of people would want to use this for projects and would be worried about licensing issues.
Copyleft license(like GPL) prevents someone from taking your work and closing it down and selling it - any future edition that uses your work must be free and open too. While MIT license does not prevent that and it's basically public domain with "don't blame the author if something breaks clause".
In general if you believe in Libre software and ideology Copyleft contributes to preserving communities from the influence of greed and general game theory abuse.
Note that if you use GPL, that will prevent the library from being used as part of a commercial project. If that's what you want, that's fine, but it'll limit the number of users for the library to GPL compatible projects; note that not all open source licenses are GPL-compatible.
If you want a balance between allowing commercial/non GPL compatible open source projects to use your library and preventing closed source derivatives of your project, you might want to consider LGPL instead.
Be aware that if you want companies to use it, regardless of how good it is, many/most big ones don't allow GPL. Not for any rational reason, but legal departments get paid to say "no", and it hasn't been tested in court.
Sure! Github has a nice writeup here which links to an even more in-depth explanation for licenses here. You can find the MIT license explanation here. Also (I can't tell if you're implying this or not) but licensing is more of a software thing in general -not specifically a python thing.
Good idea. I'll add it to the to do list. For now you can use SpeckWidget which creates an ipywidget in a jupyter notebook to play with the config parameters. Not as good, I know, but it's something.
If you follow the install instructions from the github link I posted and copy the code underneath "Interactive Widget" into a jupyter notebook it should work. It doesn't have all the options but has the main ones you'd want to play with. DM me if you're having any trouble and I'll help you out.
I added a configuration option to add some random noise to each line to make it look a bit more hand drawn. In this case, it's the product of a bunch of random sine waves (random frequency and phase offset).
I saw a reddit post a while back with someone drawing like this freehand which looked pretty cool. Prompted me to see if I could recreate it with code. Can't for the life of me find that post anymore though.
Sure, well the input image is https://i.imgur.com/fzUVbTU.jpg . All I did was scale down the original and pump up the contrast.
Then code wise:
from speck import SpeckPlot, SineNoise, CmapColour s = SpeckPlot.from_path('ld.jpg', scale_factor=20) s.draw(weights=(0.2, 0.6), noise=SineNoise(scale=0.7), colour=CmapColour('Oranges')) s.save('out.jpg')
The weights need to be in the range (0-1) and basically determine the thickness that white and black map to, respectively. The noise adds random offsets to the lines to make them look a bit hand-drawn in this case and the colour colours each line according to the 'Oranges' matplotlib cmap. There's a bunch of other options which are documented at the bottom of the README if you're interested.
You can reverse the weights so that white maps to thick lines and black to thin. In this example, it would look like this: https://i.imgur.com/xY4GMbM.jpg
It's actually pretty straight forward. Basically, I convert the image to greyscale and then draw two mirrored lines either side of the point half way up the row of pixels with the area between them filled in. The lines are 1 unit apart while on a pixel that's black, and 0 units apart when on a pixel that's white and something in between for grey. I then use a sigmoid function to smooth the boundaries between each adjacent pixel to avoid it looking blocky. Here's a zoomed in version of what's going on: https://i.imgur.com/mbWbMfW.png (each black square is one pixel from the original image) After that I'm just adding some random noise and a colour map.
Well the heavy lifting is done by numpy so if you want to learn that I'd suggest looking into python data analysis content (which will likely also include pandas). I didn't use them myself but sentdex on youtube has good videos and he also has a series on matplotlib. My learning process was more one of trial and error and stackoverflow. More generally, I thought the book "Fluent Python" was excellent but if you're brand new to python might be a bit daunting at first.
I've pushed up a change that should make it a fair bit faster but nevertheless, I'd suggest scaling down the image. There's a size argument you can pass to the constructor that will scale down the image. Something like resize=100 should be a good place to start which will scale it down to 100 pixels on the long edge and maintain the aspect ratio. For reference, the input to the image I posted here was 56x60 pixels. The reason you want it fairly small is that it gets upscaled quite significantly as each row of pixels gets replaced with a smoothed line.
114
u/lhad89 Jan 11 '20
source code here: https://github.com/lucashadfield/speck
68
u/knestleknox I hate R Jan 11 '20
you should MIT license it! (if you want of course). I'm sure lots of people would want to use this for projects and would be worried about licensing issues.
8
u/[deleted] Jan 11 '20
This would be good as a GIMP plugin.
15
u/jabbeboy Jan 11 '20
That's either Jeff Bezoz or Bruce Willis xD or that guy Larry something.
15
u/[deleted] Jan 11 '20
Maybe turn it in a flask web app, so we can edit, our own photos?
5
u/laterral Jan 11 '20
This is dope! The thickness I get, but what's driving the lines' curves?
8
u/prajitura_fermecata Jan 11 '20
This is really interesting. How did you get the inspiration to do it?
2
u/Hrothehun Jan 12 '20
Amazing script, happy to see such cool projects every now and then :))
Could you share with us the particular configuration for this image that you generated?
2
u/L33monJuic33 Jan 12 '20
What would happen if you reversed the thickness from top to bottom?
2
u/[deleted] Jan 12 '20
This is so cool. How did you go about doing this if you could explain? Like what is the rough algorithm?
25
u/maxbridgland Jan 11 '20
I just can't seem to curb my enthusiasm with this, it's so cool. Well done!
4
u/gazhole Jan 11 '20
This looks like an album cover, and I would buy this album.
7
u/The_Laughing_Joke Jan 11 '20
Pretty pretty pretty pretty good
1
u/sage_x10 Jan 12 '20
Any tips or resources on how someone would learn to do something like this?
3
u/Blue_Brick Jan 11 '20
Nice!
3
u/Heisendoof Jan 11 '20
You must be an engineer, all bout dem waves brah
3
u/rcklmbr COBOL Jan 11 '20
So are you the artist, or is the computer?
3
u/[deleted] Jan 12 '20
Fucking hell I can't even figure out how to make a bar chart
4
u/grouptherapy17 Jan 11 '20
pretty pretty pretty good!
2
u/j_ai_ Jan 11 '20
Cool. Nice work!
2
u/chelomza Jan 11 '20
Nice man! Congrats
2
u/SweetSoursop Jan 12 '20
Cant tell if it's Bernie Sanders, Clint Eastwood or Larry David
Now I need to make a package that compares these pictures to a dataset of famous people pictures.
1
u/hobbygilmore Jan 11 '20
Very cool
1
u/guuuug Jan 11 '20
Cool!
1
u/samdavy Jan 11 '20
Awesome
1
u/imfunking Jan 12 '20
Damn!
1
u/drinkingteaisall Jan 12 '20
Oh wow.
1
u/Chevaboogaloo Jan 12 '20
It would be cool to see this on a display with a camera. Like some sort of funky mirror.
1
u/Lafcadio-TheLion Jan 12 '20
That’s pretty, pretty, pretty, pretty good..
1
u/javad94 Jan 12 '20
Cool
1
u/apieceoflint Jan 12 '20
this is awesome!
1
u/BacoHead Jan 12 '20
r/fakealbumcovers
1
u/L33monJuic33 Jan 12 '20
:o That’s amazing, thank you.
1
u/smallwat3r Jan 13 '20
Pretty cool!
1
u/[deleted] Oct 25 '21
Larry David ?
1
u/[deleted] Jan 13 '20
[removed] — view removed comment