File size: 447 Bytes
2abfccb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from PIL import Image
import io
from petrel_client.client import Client


client = Client('./conf/petreloss.conf')

# read image file from ceph
img_url = 's3://bucket1/image.png'
image_data = client.get(img_url)
image = Image.open(io.BytesIO(image_data))

# write image file to ceph
new_img_url = 's3://bucket1/new_image.png'
new_image_data = io.BytesIO()
image.save(new_image_data, format='PNG')
client.put(new_img_url, new_image_data.getvalue())