I am trying to use a Python code step to download an image in Zapier. Here is some sample code (but it doesn't seem to work):
r = requests.get('https://dummyimage.com/600x400/000/fff')
img = r.raw.read()
return {'image_data': img}
The error I get is
Runtime.MarshalError: Unable to marshal response: b'' is not JSON serializable
Does anyone know how I can use requests in a Python code step in Zapier to get an image? (I am trying to get the image and save it to Dropbox.)
THANKS.
It looks like you need a json serializable object and not a binary object.
One way to convert your image to a string is to use base64 and then encode it:
Make the image serializable:
r = requests.get('https://dummyimage.com/600x400/000/fff')
img_serializable = base64.b64encode(r.content).decode('utf-8')
# check with json.dumps(img_serializable)
Now return {'image_data': img_serializable} should not give errors.
Recover image from string and save to file:
with open("imageToSave.png", "wb") as f:
f.write(base64.decodebytes(img_serializable.encode('utf-8')))
The same using codecs, that is part of the standard Python library:
r = requests.get('https://dummyimage.com/600x400/000/fff')
content = codecs.encode(r.content, encoding='base64')
img_serializable = codecs.decode(content,encoding='utf-8')
type(img_serializable)
# Out:
# str
with open("imageToSave3.png", "wb") as f:
f.write(codecs.decode(codecs.encode(img_serializable, encoding='utf-8'), \
encoding='base64'))
Related
I need to download a png file from a website and save the same in local directory .
The code is as below :
import pytesseract
from PIL import Image
from pathlib import Path
k = requests.get('https://somewebsite.com/somefile.png',stream =True)
Img=Image.open(k) # <----
Img.save("/new.png")
while executing it in JupyterNotebook
If I execute, i always get an error "response object has no attribute seek"
On the other hand , if I change the code to
Img= Image.open(k.raw), it works fine
I need to understand why it is so
You can save image data from a link using open() and write() functions:
import requests
URL = "https://images.unsplash.com/photo-1574169207511-e21a21c8075a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80"
name = "IMG.jpg" #The name of the image once saved
Picture_request = requests.get(URL)
if Picture_request.status_code == 200:
with open(name, 'wb') as f:
f.write(Picture_request.content)
Per pillow the docs:
:param fp: A filename (string), pathlib.Path object or a file object.
The file object must implement file.read,
file.seek, and file.tell methods,
and be opened in binary mode.
response itself is just the response object. Using response.raw implements read, seek, and tell.
However, you should use response.content to get the raw bytes of the image. If you want to open it, then use io.BytesIO (quick explanation here).
import requests
from PIL import Image
from io import BytesIO
URL = "whatever"
name = "image.jpg"
response = requests.get(URL)
mybytes = BytesIO()
mybytes.write(response.content) # write the bytes into `mybytes`
mybytes.seek(0) # set pointer back to the beginning
img = Image.open(mybytes) # now pillow reads from this io and gets all the bytes we want
# do things to img
I tried to decode the following base64 image
data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyCAYAAACqNX6+AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAASwSURBVHhe7VoxaxsxFPYvye5sJZC5JRkcSoZCoMSFDIVOGWpSQ6FDqLN5CqGBEnAIoe7sKTSbF2fqmiWbMWTLkl+gPp2k89P56U7Syc7Z1Qdf6+9OTz70qvednlv78efwNWPsuyLo9HPUi9c1/sf57SH8NUXUL6eThPAPISfliNpPpwnhCDWpQtTumntImhCOEJNiRO2mo4cAqqSjh0hURUcPQaiCjh5SMR09BFAlHT1Eoio6eghCFXT0kIrp6CGAl9DDdo3VagThfkkPeWBntRP21okX7Oja9/sE3PSEXe7U2e/19Vl2RsmIsN9n0kPWppKACaPKechwQCx4ARsj9qjiEdz1R3bfnF3oO7HGcP89u6sbEpEhjyn/PGZt3BFZlvWQ4z1iwQvY6j3JaPfvw3rSIRa7vgX7QWHEriwTwjmfpBywXoNYeBMhpoSH4HI1YH/lVf/5BAr16Ra5oAmhBE3Hj8QO2dllz/IKR3p/1NFjm/1knPPzGPU4JxltKGAC57fvpqUMtL+H4HK190XeEfCaD0HT2YUzsd5k93J7WM+P56530t1lHS9BaWOZag9nxp+01sQ9+OztIbhcnUG6XeNtNVmaKJp2ggStJ1Mfqm+mCeWwi59C08P2bCIS4p1BjPf3kEWVK3tjvulPPOZHLwawwy77rvGUNpeq7a4hXiUEPvp5yCqUqwTI+GXJcosndPfVTC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rbh4ikacfexfp7gjVai9VrubqGQLO2nR4hHuBPUQvV/zQqOA/f4lypTUPA75NAXy10WM23oT3kG7rWNsd3ZLzJdq3XBGdXKvvQ3DTw8QTGr2x1Pr9fLMXbRUrD+GLbGPMWqkC7xjI5yqav0h7lyvbPhgmzOvdYDR2eIu4xlQOLTzkiQ0aapGB7YfkqjYeXnP300QIfjJ1NSVM2rrVTjHbi/JMiK/H+L3u6g3HYg/JnClsqHyDnA9hRvd3ydJky5leVN4viybavigAdC3KFb3oNKneVqGHaJ5QxJKe8dxv0otkw4V4RI52KVfGrq/L/8vKaSiGaSAa3qRsGah1zuGjC8tVo8eU1efNZ+EhAsumyaQ5MPTz2OpiD0FYJk0tsgs5Qj4Ph43O9RCqPPlSwechMVZd53oItbC+xHB9yP9Jr6yHLKteWQ/hWEY9p99DpojaTed6iELUi9PRQySqoqOHIFRBRw+pmI4eAqiOZuwfl74j6FwpdBsAAAAASUVORK5CYII=""")
print(base64.b64decode(x))
also with using encode("ascii") for x:
import base64
x = """iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyCAYAAACqNX6+AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAASwSURBVHhe7VoxaxsxFPYvye5sJZC5JRkcSoZCoMSFDIVOGWpSQ6FDqLN5CqGBEnAIoe7sKTSbF2fqmiWbMWTLkl+gPp2k89P56U7Syc7Z1Qdf6+9OTz70qvednlv78efwNWPsuyLo9HPUi9c1/sf57SH8NUXUL6eThPAPISfliNpPpwnhCDWpQtTumntImhCOEJNiRO2mo4cAqqSjh0hURUcPQaiCjh5SMR09BFAlHT1Eoio6eghCFXT0kIrp6CGAl9DDdo3VagThfkkPeWBntRP21okX7Oja9/sE3PSEXe7U2e/19Vl2RsmIsN9n0kPWppKACaPKechwQCx4ARsj9qjiEdz1R3bfnF3oO7HGcP89u6sbEpEhjyn/PGZt3BFZlvWQ4z1iwQvY6j3JaPfvw3rSIRa7vgX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k0tsgs5Qj4Ph43O9RCqPPlSwechMVZd53oItbC+xHB9yP9Jr6yHLKteWQ/hWEY9p99DpojaTed6iELUi9PRQySqoqOHIFRBRw+pmI4eAqiOZuwfl74j6FwpdBsAAAAASUVORK5CYII=""".encode("ascii")
print(base64.b64decode(x))
I saved the result as PNG image and JPG.
the issue here that the files didn't open, and I dont understand how the whole thing works. I watched some tutorials and I failed to display the image on my computer.
try to write to the image file the binary of this string like this
f = open('img.png', 'wb')
f.write(base64.b64decode(x))
f.close()
You could do as follows:
import base64
image_64_decode = base64.decodestring(x)
image_result = open('filename.png', 'wb') # create a writable image and write the decoding result
image_result.write(image_64_decode)
I'm testing some things and i keep getting the error "write() argument must be str, not HTTPResponse" Here's my code:
import requests
image="http://www.casperdenhaan.nl/wp-content/uploads/2020/03/Logo.jpg"
savefile=open("image.png","w+")
savefile.write(requests.get(image).raw)
savefile.close()
I can get the raw data, but I can't write it to a new file. Is there a way i could get around this problem?
When you call .raw on the response object it returns an HTTPResponse object. You need to call .content to get a bytes object.
type(requests.get(image).raw)
urllib3.response.HTTPResponse
type(requests.get(image).content)
bytes
You need to open the file in write binary mode:
open("image.png","wb")
I suggest using a "with" block, this way you don't need to explicitly close the file. Here is a working version of the code:
import requests
url = "http://www.casperdenhaan.nl/wp-content/uploads/2020/03/Logo.jpg"
with open('image.png', 'wb') as f:
f.write(requests.get(url).content)
try this way of doing it
import requests
img_url = "http://www.casperdenhaan.nl/wp-content/uploads/2020/03/Logo.jpg"
img = requests.get(img_url)
with open('image.png', 'wb') as save_file:
save_file.write(img.raw)
This way you don't have to deal with closing the file. Also, the 'wb' opens the file in a writable binary mode.
I have a string in base64 format, which represents PNG image. Is there a way to save this image to the filesystem, as a PNG file?
I encoded the image using flex. Actually this is what I get on server
(can't see any image after any of proposed methods :( )
iVBORw0KGgoAAAANSUhEUgAABoIAAAaCCAYAAAABZu+EAAAqOElEQVR42uzBAQEAAACAkP6v7ggK\nAAAAAAAAAAAAAAAAAAAAAAAAA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
fh.close()
# or, more concisely using with statement
with open("imageToSave.png", "wb") as fh:
fh.write(img_data.decode('base64'))
Modernizing this example to Python 3, which removed arbitrary codec support from string/bytes .encode() and .decode() functions:
# For both Python 2.7 and Python 3.x
import base64
with open("imageToSave.png", "wb") as fh:
fh.write(base64.decodebytes(img_data))
If the imagestr was bitmap data (which we now know it isn't) you could use this
imagestr is the base64 encoded string
width is the width of the image
height is the height of the image
from PIL import Image
from base64 import decodestring
image = Image.fromstring('RGB',(width,height),decodestring(imagestr))
image.save("foo.png")
Since the imagestr is just the encoded png data
from base64 import decodestring
with open("foo.png","wb") as f:
f.write(decodestring(imagestr))
As simple as that!
import io, base64
from PIL import Image
# Assuming base64_str is the string value without 'data:image/jpeg;base64,'
img = Image.open(io.BytesIO(base64.decodebytes(bytes(base64_str, "utf-8"))))
img.save('my-image.jpeg')
If you are trying to decode a web image you can simply use this :
import base64
with open("imageToSave.png", "wb") as fh:
fh.write(base64.urlsafe_b64decode('data'))
data => is the encoded string
It will take care of the padding errors
import base64
from PIL import Image
import io
image = base64.b64decode(str('stringdata'))
fileName = 'test.jpeg'
imagePath = ('D:\\base64toImageNewPath\\'+fileName)
img = Image.open(io.BytesIO(image))
img.save(imagePath, 'jpeg')
You can also save it to a string buffer and then do as you wish with it,
import cStringIO
data = json.loads(request.POST['imgData']) # Getting the object from the post request
image_output = cStringIO.StringIO()
image_output.write(data.decode('base64')) # Write decoded image to buffer
image_output.seek(0) # seek beginning of the image string
# image_output.read() # Do as you wish with it!
In django, you can save it as an uploaded file to save to a model:
from django.core.files.uploadedfile import SimpleUploadedFile
suf = SimpleUploadedFile('uploaded_file.png', image_output.read(), content_type='image/png')
Or send it as an email:
email = EmailMessage('Hello', 'Body goes here', 'from#example.com',
['me#me.com', ])
email.attach('design.png', image_output.read(), 'image/png')
email.send()
You can use Pillow.
pip install Pillow
image = base64.b64decode(str(base64String))
fileName = 'test.jpeg'
imagePath = FILE_UPLOAD_DIR + fileName
img = Image.open(io.BytesIO(image))
img.save(imagePath, 'jpeg')
return fileName
reference for complete source code: https://abhisheksharma.online/convert-base64-blob-to-image-file-in-python/
Try this solution,
image file --> binary encoded string
binary encoded string --> image file
import base64
"""
1st step - convert image into binary
"""
with open("original_image.png", "rb") as original_file:
encoded_string = base64.b64encode(original_file.read())
print(encoded_string)
# xmzWowsfJbpGwCe0DTveqwvos7Mf0lcVNe/Q+G1hO/p+UNPd/stUse8AhP/3fDixf8HI3No67nvhlYAAAAASUVORK5CYII='
print(type(encoded_string))
# <class 'bytes'>
"""
2nd step - create new image using the encoded string
"""
with open("new_image.png", "wb") as new_file:
new_file.write(base64.decodebytes(encoded_string))
References:
Encoding an image file with base64
How to make a binary image with python?
You could probably use the PyPNG package's png.Reader object to do this - decode the base64 string into a regular string (via the base64 standard library), and pass it to the constructor.
A customer sends a multipart file to me, I read it with:
blob = request.files['file'].read()
I have a blob file in hand. Now I have to send this file with requests like open('file.png', 'rb'). How can I convert blob to something like rb mode. With open I could not open blob directly.
The below code did not work:
opened_file = open(request.files['file'], 'rb')
And I got the following error:
TypeError: coercing to Unicode: need string or buffer, FileStorage found
Is there a way to do that without saving it on file system? I send my requests to somewhere else:
files = dict({'file': byteArrayFile})
r = requests.post(self.url, files=files, headers=headers)
request.files['file'] is already a file-like object (it's a FileStorage instance), so you can use that directly; you don't need to open it.
r = requests.post(self.url, files={"file": request.files["file"]}, headers=headers)
You can think of a file-like object as an open file. They behave the same way.
try using
from PIL import Image
import requests
from io import BytesIO
response = requests.get(url)
img = Image.open(BytesIO(response.content))
it worked for me and for testing if you wish to have a look on the images try
img.show()
If your image is stored in a Blob format (i.e. in a database) you can use the same technique explained by Billal Begueradj to convert your image from Blobs to a byte array.
In my case, I needed my images where stored in a blob column in a db table:
def select_all_X_values(conn):
cur = conn.cursor()
cur.execute("SELECT ImageData from PiecesTable")
rows = cur.fetchall()
return rows
I then created a helper function to change my dataset into np.array:
X_dataset = select_all_X_values(conn)
imagesList = convertToByteIO(np.array(X_dataset))
def convertToByteIO(imagesArray):
"""
# Converts an array of images into an array of Bytes
"""
imagesList = []
for i in range(len(imagesArray)):
img = Image.open(BytesIO(imagesArray[i])).convert("RGB")
imagesList.insert(i, np.array(img))
return imagesList
After this, I was able to use the byteArrays in my Neural Network.
plt.imshow(imagesList[0])