I am using google app engine, I take user uploaded images(as based64). I am now deciding between decoding it then store it or storing the data directly in a file. I do not need to resize the image, but I do need to use it for my "upper layer" as I am building a zoomed out image that includes many user uploaded images(a mosaic). Do you guys think I should decode it or just save it. I am using python 2.7.
Asked
Active
Viewed 44 times
0
-
1If you plan to store a cached version of the image or you plan to gzip it, you should store it as a file – Dennis Nov 15 '19 at 01:04
-
Base64 has 4/3 of the size of the data it encodes. If you want to store a large amount of image data, you shouldn't use base64. Of course you could compress the base64 but converting it to the encoded data is easier and more useful. – Michael Butscher Nov 15 '19 at 01:10
1 Answers
0
I would usually default to storing it decoded as an image file (eg. as a .jpg, .png, etc) in some sort of file storage system (such as AWS S3 or on a filesystem). This works well if you need to download the file or display it in places, because it's easier to cache and download in parallel and view.
I'm not sure of any reason why you would choose to store encoded as base64 data as this is not easily viewable by many tools.

Yep_It's_Me
- 4,494
- 4
- 43
- 66
-
I am very new to all of this(like 3 weeks new) so can you explain what you mean by "storing it"? Like do I decode it or not? – Darren Zou Nov 15 '19 at 01:09
-
Edited my question to be be more explicit. I'm suggesting decoding it and storing it as an image file, instead of raw base64 data. Does that make sense? – Yep_It's_Me Nov 15 '19 at 01:24
-
Thanks for the clarification! now I got one more issue, no matter what I try when decoding, I keep on getting an "incorrect padding error' – Darren Zou Nov 15 '19 at 01:40
-
1I'm not sure what would be causing that but it sounds like your base64 data has been corrupted. Check out [this question](https://stackoverflow.com/q/2941995/1393498) which seems to be the same problem. – Yep_It's_Me Nov 15 '19 at 01:45