首页 > 编程知识 正文

图片压缩有什么坏处,如何将图片改为jpg

时间:2023-05-03 21:57:28 阅读:171960 作者:4956

publicstaticvoidreduceimg (string img src,String imgdist,int widthdist,int heightdist ) try{filesrcfile=newfile ) img srch srcfile.exists () ) { return; } image src=javax.imageio.imageio.read (srcfile ); bufferedimagetag=newbufferedimage () int (width dist,) int (height dist,BufferedImage.TYPE_INT_RGB ); tag.get graphics (.drawimage (src.getscaledinstance ) widthdist,heightdist,Image.SCALE_SMOOTH ),0,nullllaphich nu//tag.get graphics (.drawimage (src.getscaledinstance ) widthdist,heightdist,image.scale _ area _ averaginnge 精力充沛的海豚=JPEG codec.createjpegencoder (out ); encoder.encode(tag; out.close (; }catch(ioexceptionex ) { ex.printStackTrace ); }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。