Forked from ehrentreu/create image from random colors
Created
November 1, 2019 05:58
-
-
Save nonZero/bc041ac9e19649617b014c5419c2a48e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%pylab inline | |
BRUSH_STROKE_SIZE = 4 | |
palette = imread('palette.png') | |
image = imread('starry-night-800.jpg') | |
png = np.ones(image.shape) | |
num_of_strokes = [1000, 10000, 100000] | |
for num in num_of_strokes: | |
for index in range(num): | |
row = np.random.randint(0, png.shape[0]-4) | |
column = np.random.randint(0, png.shape[1]-4) | |
color = np.random.randint (0, palette.shape[1]-1) | |
png[row:row + BRUSH_STROKE_SIZE, column:column + BRUSH_STROKE_SIZE] = palette[0,color] | |
imshow(png) | |
figure() | |
imsave(f"random{num//1000}k.png", png) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment