I have a BLOB
that is retrieved from a MySQL database as follows:
Blob imageBlob;
while (rs.next()) {
imageBlob= rs.getBlob("face");
}
after that my imageBlob
is something like this: data:image/png;base64,iVBORw0KGgoAAAANSUhE................
I've been googling around but I haven't found any solution to my problem: how do I create an image file and save it on the disk from this BLOB?
imageBlob
is storing the base64 representation of your image data. For storing that onto your disk you need to decode that base64 representation into the original binary format representation.First convert the Blob to BuffededImage:
Then BufferedImage to Image: