There is the function:
if form.is_valid():
image = grab_image(request.FILES['photo'])
image_name = str(uuid.uuid4())
path_to_image = settings.MEDIA_ROOT + '\\' + image_name + '.jpg'#Image path definition
cropped_image = crop_face(image)
if cropped_image is not None:
cv2.imwrite(path_to_image, cropped_image)#writing image to disk
print(type(cropped_image))#'numpy.ndarray'
uploaded_image = im.upload_image(path_to_image, title=image_name)#sending image to imgur
os.remove(os.path.join(settings.MEDIA_ROOT, image_name + '.jpg'))#It is delete image from disk
I upload images to imgurl (using pyimgur) in this way: save the image to disk, to the media folder, and then call the im.upload_image (path_to_image) method, to which I transfer the path to the file and then delete the image from the disk. Is it possible to do without saving the image to disk? Image type - 'numpy.ndarray'