Skip to content

Instantly share code, notes, and snippets.

@dangpzanco
Created January 27, 2020 05:07
Show Gist options
  • Save dangpzanco/4e09ed191016784519550ad3eba92349 to your computer and use it in GitHub Desktop.
Save dangpzanco/4e09ed191016784519550ad3eba92349 to your computer and use it in GitHub Desktop.
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