|
@ -303,10 +303,17 @@ public class ImageService {
|
303
|
303
|
@Path("/head")
|
304
|
304
|
public void saveHeadPhoto(String id, String fn,int x,int y,int w,int h) throws JfwBaseException, SQLException, IOException {
|
305
|
305
|
byte[] src = this.readTmpFile(fn);
|
|
306
|
//png图片保存为JPG格式时透明底色会变红的问题
|
|
307
|
// BufferedImage im = ImageIO.read(new ByteArrayInputStream(src));
|
|
308
|
// BufferedImage newBufferedImage = new BufferedImage(im.getWidth(),im.getHeight(), BufferedImage.TYPE_INT_RGB);
|
|
309
|
// newBufferedImage.createGraphics().drawImage(im, 0, 0, Color.WHITE, null);
|
|
310
|
// ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
311
|
// ImageIO.write(newBufferedImage, "jpg", os);
|
|
312
|
// src = os.toByteArray();
|
306
|
313
|
src = JpgUtil.read(src);
|
307
|
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
308
|
|
JpgUtil.cutByPerCent(new ByteArrayInputStream(src), os, x, y, w, h);
|
309
|
|
src = os.toByteArray();
|
|
314
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
315
|
JpgUtil.cutByPerCent(new ByteArrayInputStream(src), bos, x, y, w, h);
|
|
316
|
src = bos.toByteArray();
|
310
|
317
|
// byte[] li = this.zoomImage(src, this.largeHeadPhotoWidth, this.largeHeadPhotoHeight);
|
311
|
318
|
byte[] mi = this.zoomImage(src, this.middleHeadPhotoWidth, this.middleHeadPhotoHeight);
|
312
|
319
|
byte[] si = this.zoomImage(src, this.smallHeadPhotoWidth, this.smallHeadPhotoHeight);
|