imageFromS3[source]

imageFromS3(bucket:str, key:str, **kwargs)

obtain the image url from the S3 bucket and returns it

bucket: str: the name of the bucket containing the image

key: str: the key of the image

imageFromUrl[source]

imageFromUrl(url)

returns the image from the inputted url

url: str: the url of the image

imageToS3[source]

imageToS3(image:PIL.Image, bucket:str, key:str)

saves the image inputted to the S3 bucket

image: Image: the image that is going to be saved

bucket: str: the name of the bucket where the image will be saved , key: str: the key of the image

resizeImage[source]

resizeImage(url:str, width:int)

resize the image from the url to the width stated

url: the url of the image

width: int: the image will be resized to this width (measured in pixels)

url = 'https://thethaiger.com/wp-content/uploads/2021/02/cat.jpg'
resizeImage(url, 400)

showImgS3[source]

showImgS3(bucket:str, key:str)

show the image obtained from the S3 bucket

bucket: str: the name of the bucket containing the image

key: str: the key of the image

key = 'testCat.png'
path = '/tmp/testCat.png'
bucket = 'villa-remove-bg-small-output'
url = 'https://sites.google.com/site/funnycatmeawww/_/rsrc/1422326075261/home/6997052-funny-cat.jpg?height=675&width=1200'
img = imageFromUrl(url)
imageToS3(img, bucket, key)
showImgS3(bucket, key)
S3.deleteFile(key,bucket)
print(S3.exist(key,bucket))
saving image to villa-remove-bg-small-output/testCat.png
False