for reason, opening png files using imagebuffer , imageio not work. here's code using works fine resizing/cropping jpgs: bufferedimage image = imageio.read(new file(location)); bufferedimage croppedimage = image.getsubimage( cropinfo.getx(), cropinfo.gety(), cropinfo.getw(), cropinfo.geth()); bufferedimage resizedimage = new bufferedimage( target_width, target_height, croppedimage.gettype()); graphics2d g = resizedimage.creategraphics(); g.drawimage(croppedimage, 0, 0, target_width, target_height, null); g.dispose(); this.changecontenttype("image/png", ".png"); // not relevant. property imageio.write(resizedimage, "png", new file(location)); return resizedimage; the goal of function take whatever type given, resize , crop image, , save png same filename. it works on windows, if crop/resize on linux (lenny), crashes altogether , complains type of file (it says type 0). java.lang.illegalargumentexception: unknown image type 0 ...