压缩java中的图像 [英] Compress image in java

查看:80
本文介绍了压缩java中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道有没有一种方法可以将存储在oracle db中的图像压缩为blob

,因为我将blob转换为base64图像,然后将其返回到servlet中。 />


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();

if(!rs.next())
{
	return;
}			

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

推荐答案

试试 https://www.google.com/search?q=compress+image+java [ ^ ]。


这篇关于压缩java中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆