源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

java将图片分割为几个部分示例

  • 时间:2021-10-26 05:28 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:java将图片分割为几个部分示例
以下代码使用java将图片分割为几个部分,大家参考使用吧
[u]复制代码[/u] 代码如下:
public class SegmentationImage{    public static Icon Segmentation(String imagename,int Width,int Height,int height,int width) throws Exception{   // 准备分割图片      BufferedImage img1=ImageIO.read(new File(imagename));      int half_w=img1.getWidth();    int rgb[]=new int[half_w*img1.getHeight()];    img1.getRGB(0, 0, half_w, img1.getHeight(), rgb, 0, half_w);    BufferedImage img_half=new BufferedImage(half_w, img1.getHeight(), BufferedImage.TYPE_INT_ARGB);    img_half.setRGB(Width,Height,height,img1.getHeight(), rgb,width,half_w);    Icon returnIcon = new ImageIcon(img_half);       return returnIcon; } }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部