Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

No matter, how the imencode does it's part. It will always require imdecode to extract the image back.

This end result seems to be off-topic

For my case I needed to save the processed image so wanted to know how the image was encoded in imencode but I actually didn't find a specific answer.

This could be a work around to my problem, I'll be trying it after this post. May be will be helpful for anyone with similar problem.

No matter, how the imencode does it's part. It will always require imdecode to extract the image back.

This end result seems to be off-topic

For my case I needed to save the processed image so wanted to know how the image was encoded in imencode but I actually didn't find a specific answer.

This could be a work around to my problem, I'll be trying it after this post. May be will be helpful for anyone with similar problem.

PS:

Found a simple solution, use a Tempfile to store the image using cv2.imwrite,then upload this Tempfile

Here's the code

with NamedTemporaryFile() as temp:
            # Extract name to the temp file
            iName = "".join([str(temp.name), ".jpg"])
            # save image to temp file
            cv2.imwrite(iName, duplicate_image)