You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

convert_to_jpeg.py 569B

1234567891011121314151617181920
  1. from PIL import Image
  2. import zarr
  3. import tifffile
  4. def convert_tif_to_jpeg():
  5. input_address = "data/test/1672.tiff"
  6. # outfile = "data/test/out.jpeg"
  7. outfile = "data/test/out.zarr"
  8. image_zarr = tifffile.imread(input_address, aszarr=True, key=0)
  9. zarr_image = zarr.open(image_zarr, mode='r')
  10. zarr.save(outfile, zarr_image)
  11. ## RAM PROBLEM
  12. # im = Image.open()
  13. # out = im.convert("RGB")
  14. # out.save(outfile, "JPEG", quality=90)
  15. if __name__ == '__main__':
  16. Image.MAX_IMAGE_PIXELS = 1000 * 1000 * 256 * 256
  17. convert_tif_to_jpeg()