开发者

Difference in Length of ImageBytes while performing PIL IMAGE .getvalue() operation on AWS LAMBDA?

开发者 https://www.devze.com 2022-12-07 18:29 出处:网络
I am trying to perform .getvalue() operation on PIL image on AWS Lambda to extract the bytes of PIL Image but my byte string length is different when i perform this operation on Local Machine and Its

I am trying to perform .getvalue() operation on PIL image on AWS Lambda to extract the bytes of PIL Image but my byte string length is different when i perform this operation on Local Machine and Its different when i Perform it on AWS Lambda, below is code

if base64_message[0:4] == b'%PDF':
        

       
        images = convert_from_bytes(base64_message, dpi=120, poppler_path=poppler_path)
   
    
        img_byte_arr = io.BytesIO()
        for img_page in (images):
           
            img_page.save(img_byte_arr, format = "jpeg")
            break
        img_obj = img_开发者_高级运维byte_arr.getvalue()

**print(len(img_obj))**


        

Basically I am trying using pdf2image library to get image byte from pdf but length of the bytes are different on Local Machine and its Different on AWS lambda which impacting by futher operation.

for particular Image, length of Imagebyte on AWS Lambda is 122103 and for same image it's 122551 on Local Machine

0

精彩评论

暂无评论...
验证码 换一张
取 消