9/21/2021

python pil change dpi without save file

 


look at the code! ^^

..

#load image
tif_path = './input_img.tif'
#open image
pil_image = Image.open(tif_path)
#change dpi in memory
temp_mem_file = BytesIO()
page.save(temp_mem_file, format='png', dpi=(100,100))
#save it to pil
temp_mem_file.seek(0)
pil_image = Image.open(temp_mem_file)
#do it someting
#..
#save file
pil_image.save('./output.png')
#www.marearts.com
#study.marearts.com

..


Thank you.