Click here to Skip to main content
15,615,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to know is there a way that i can compress an image which is stored in oracle db as blob
as i am converting blob to base64 image and then returning it in servlet.

JSONObject obj = new JSONObject();


obj.put("NAME", rs.getString("NAME"));
obj.put("address", rs.getString("ADDRESS"));
Blob frontPicBlob =  rs.getBlob("frontPic");
Blob backPicBlob =  rs.getBlob("backPic");

obj.put("frontPic", DatatypeConverter.printBase64Binary(frontPicBlob.getBytes(1,(int)frontPicBlob.length())));
obj.put("backPic",DatatypeConverter.printBase64Binary(backPicBlob.getBytes(1,(int)backPicBlob.length())) );

as images are big is size i want to know if there a way to compress the image . or is there any way to do it efficently

1 solution

Share this answer
agha_ali22 9-Feb-14 11:12am    
already tried that solution
Richard MacCutchan 9-Feb-14 12:05pm    
How is that possible, since all I gave you was a Google search?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900