from PIL import Image
import pytesseract
# Load the image from the file system
img_path = '/mnt/data/image.png'
img = Image.open(img_path)
# Since OCR may not be effective on this image due to its simplicity and lack of actual text,
# let's try to analyze the image directly to find the side length 'a' by finding the width of the square.
# The image appears to have a large square with a smaller square inside it, both aligned to the bottom left corner.
# Convert the image to black and white to simplify analysis
bw_img = img.convert('1')
# Get the size of the image
width, height = bw_img.size
# Scan the image horizontally from the left until we find the first black pixel
# This will be the left edge of the outer square
for x in range(width):
if bw_img.getpixel((x, height // 2)) == 0: # Look at the middle of the height for a horizontal line
left_edge = x
break
# Scan the image horizontally from the left edge to find the first white pixel
# This will be the right edge of the outer square
for x in range(left_edge, width):
if bw_img.getpixel((x, height // 2)) == 255:
right_edge = x
break
# The length of the side 'a' is the difference between the right and left edges
side_length_a = right_edge - left_edge
side_length_a