Beta
Table of Contents
The outline of your notebook will show up here. You can include headings in any text cell by starting a line with #
, ##
, ###
, etc., depending on the desired title hierarchy.
print(2)
from PIL import Image, ImageDraw, ImageFont
import math
# Load the image
img_path = './musta aukko.jpg'
image = Image.open(img_path)
# Constants for the equations
equations = [
"c^2 = a^2 + b^2",
"E = mc^2",
"F = G \\frac{m_1 m_2}{r^2}",
"\\frac{d^2r}{dt^2} = -\\frac{GM}{r^2}",
"S = \\pi r^2",
"\\Psi(r,\\theta,\\phi) = R(r)\\Theta(\\theta)\\Phi(\\phi)"
]
# Define the draw object
draw = ImageDraw.Draw(image)
# Function to calculate the position of the text
def get_text_position(angle, radius, image_size):
x = int(image_size[0]/2 + radius * math.cos(angle))
y = int(image_size[1]/2 + radius * math.sin(angle))
return x, y
# Font size and type
font_size = 20
font = ImageFont.truetype("arial.ttf", font_size)
# Angle and radius
start_angle = 10
angle_step = 1 # radians
radius_step = 1.0 # pixels per step
radius = 5
# Draw the equations spiraling outwards
for equation in equations:
angle = start_angle
while radius < min(image.size)/2:
x, y = get_text_position(angle, radius, image.size)
draw.text((x, y), equation, font=font, fill=(255,255,255,255))
angle += angle_step
radius += radius_step
radius += 20 # Increase initial radius for the next equation
# Save the modified image
modified_img_path = './musta aukko_mod.jpg'
image.save(modified_img_path)
modified_img_path
Current Type: Bar
Current X-axis: None
Current Y-axis: None
Current Color: None