Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import pathlib
import tqdm
import imageio
# import PIL.Image
# PIL.Image.MAX_IMAGE_PIXELS = 933120000
# input_path = pathlib.Path('Starry Night.jpg')
input_path = pathlib.Path('Starry Night (small).jpg')
im = imageio.imread(input_path)
image_folder = input_path.with_suffix('')
image_folder.mkdir(parents=True, exist_ok=True)
for i in tqdm.trange(100):
image_path = image_folder / f'image{i}.jpg'
imageio.imwrite(image_path, im, format='jpg', quality=100-i)
im = imageio.imread(image_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment