比如说我要把原本600*600的图片 四周补白 变为800*800的 应该调用什么接口?

解决方案 »

  1.   

    读出来,重新创建一个800×800的bufferedImage
    然后读入原来的像素数据即可
    对周围100个像素单位设置为白色即可。easy to do~~~
    更多图像处理可以看我博客。
      

  2.   

    你说的这个我知道但是我不想用java来处理图像,我是想问jmagick有没有现成的接口?
    BufferedImage pic = new BufferedImage(trueWidth, trueHeigth,
    image.getType());
    Graphics2D g = pic.createGraphics();
    g.setColor(Color.white);
    g.fillRect(0, 0, trueWidth, trueHeigth);
    g.drawImage(image, (trueWidth - srcWidth) / 2,
    (trueHeigth - srcHeigth) / 2, srcWidth, srcHeigth,
    Color.white, null);
    g.dispose();