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
def getColor(x, y): | |
return (random.randint(0, 1) ,)*3 |
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
from PIL import Image | |
width = 512 | |
height = 512 | |
# Magic happens here | |
def getColor(x, y): | |
return (0, 0, 0) | |
# Create an image and load pixels |
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
def getColor(x, y): | |
a = pnoise2(x/scale, | |
y/scale, | |
octaves = octaves, | |
persistence = persistence, | |
lacunarity = lacunarity) | |
a = int(127*(a+1)) # a is between -1 and 1, this gives us values between 0 and 255 | |
return (a,)*3 |
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
scale = 75 | |
octaves = 8 | |
persistence = 0.5 | |
lacunarity = 2 | |
land = (133, 222, 70) | |
water = (21, 60, 177) | |
def getColor(x, y): | |
a = pnoise2(x/scale, |
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
from PIL import Image | |
width = 800 | |
height = 600 | |
def getpixel(x, y): | |
n = 0.5 # Get value here | |
return int(255*n) | |
# Create a new image. L for grayscale |
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
import bpy | |
from math import * | |
# Settings | |
width = 800 | |
height = 800 | |
z_height = 0.25 # Displace modifier strength | |
tex_res = 1 # Texture resolution (1:1) | |
mesh_res = 4 # Mesh resolution (8:1) |
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
# Returns matrix product of A and B | |
def prod(A, B): | |
# Dimensions | |
m = A.shape[0] | |
n = A.shape[1] # same as B.shape[0] | |
p = B.shape[1] | |
# Initialize an empty (m,p) matrix | |
C = np.zeros((m, p)) | |
# Fill it | |
for i in range(m): |
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
np.einsum("ik,kj->ij", A, B) |
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
from PIL import Image | |
# Open image | |
image = Image.open('image.jpg') | |
# Show image | |
image.show() |
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
from PIL import Image | |
# Open image | |
image = Image.open('image.jpg') | |
# Filter | |
def filter(image): | |
# Get image dimesions | |
width, height = image.size |
OlderNewer