def add_num(image_path): im = imager.open_image(image_path) if im is not None: font = ImageFont.truetype('Arial.ttf', 20) w, h = im.size point = (w - 10, 0) imager.draw_text(im, "8", point, font) im.show()
def reset_images_size(dir_path=None): if dir_path is None: return for root, dirs, files in os.walk(dir_path): for path in files: if path.startswith("."): continue file_path = os.path.join(root, path) image = imager.open_image(file_path) if image is not None: new_image = imager.reset_image_size(image, 640, 1136) imager.save(new_image, file_path)