Hi All,
i am trying to resizing the handwritten letter to 30x30 pixel using python.
In mspaint , i draw a letter "A" and try to resize the letter using the below code and it works.
I want to center the image if my letter is on the left side then program should crop the right side and unwanted blank space]and resize the image. How can i achieve this.
i am trying to resizing the handwritten letter to 30x30 pixel using python.
In mspaint , i draw a letter "A" and try to resize the letter using the below code and it works.
I want to center the image if my letter is on the left side then program should crop the right side and unwanted blank space]and resize the image. How can i achieve this.
from PIL import Image input_img = Image.open('C:\Users\Admin\Desktop\letterA.jpg') input_img.size new_width = 30 new_height = 30 input_img = input_img.resize((new_width, new_height), Image.ANTIALIAS) input_img.save('C:\Users\Admin\Desktop\output.jpg') output_img = Image.open('C:\Users\Admin\Desktop\output.jpg') output_img.size