Been working in Java with images from the web encoded as base64 strings. I have only seen image/png format in img src tags i.e. data:image/png;base64,{eNc0d3d_St!ng...}
I have not seen image/gif or image/jpg. I have looked on SO and read a little on base 64 encoding.
Furthermore, I strip off the data:image/png;base64
part in Java (Android) when doing
Base64.decode(src, Base64.DEFAULT)
so it looks like there is no need for the png in that situation. In fact if I do not strip off this "header" then BitmapFactory.decodeByteArray
returns null.
So the question is, are there other formats other than png for image encoding on the web?
image/png
part is redundant, but this may not be the case for all possible formats that can be represented using the data URI scheme. So it does have a purpose. Also, keep in mind that the;base64
part i optional, don't just blindly send the data to the Base64 decoder. – Raised