Ask Your Question

Revision history [back]

The solution here will depend on exactly what your problem is. You're reading an uncompressed image from a bag file and then saving it into a memory file using an image file format JPEG in the case of your code above.

You said you want the original size image loaded into s3. The important question is why. Are you concerned about loss of image quality from a lossy image compression format, or is it necessary that the memory file takes up the same number of bytes as the uncompressed image?

If you're concerned about loss of image quality I would recommending simply switching to a lossless format such as PNG. This will still compress your image in most cases but exactly the same pixel data can be recovered afterwards.

If you're concerned that the memory file should be exactly the same size as the uncompressed image, then you could just write the raw buffer of the numpy.array to the file.

Hope this helps.