Speak this: Java convert downloaded blob to image
Injustice comics free download | 385 |
Adobe photodeluxe home edition 4.0 free download | 366 |
Free logo design and download no catch | 471 |
Qualcomm atheros ar9485 802.11b/g/n wifi adapter driver download | 273 |
Image to ByteArray to BLOB and BLOB to ByteArray to Image Conversion Issues in Java
Firstly, you should separate this into two parts:
- Storing binary data in a database and retrieving it
- Loading an image file and saving it again
There's no need to use a database to test the second part - you should diagnose the issues by loading the image and saving straight to a file, skipping the database.
No, I believe the problem is that you're copying the data from the WritableRaster's databuffer, and then saving that to a file. It's not a jpeg at that point - it's whatever the internal format of the uses.
If you want a jpeg file, you don't need to use ImageIO at all - because you've started off with a jpeg file. If you want to start and end with the same image, just copy the file (or save the file to the database, in your case). That's just treating the file as bytes.
If you need to do something like saving in a different format, or at a different size, etc, then you should ask the ImageIO libraries to save the image as a JPEG again, re-encoding it... and then store the result as a file or in the database etc.

-
-
-