public static boolean renderImage(OutputStream output,
                                      InputStream input) {        try {
            // イメージの読み込み | read image use JAI(SeekableSteam ,RenderedOp)
            SeekableStream ss = SeekableStream.wrapInputStream(input, true);
            PlanarImage src = JAI.create("stream", ss);            // サムネールの作成 // | Construct Thumbnail            // 画像サイズの取得 | get the size of image
            float srcWidth = Float.parseFloat(src.getProperty("image_width").
                                              toString());
            float srcHeight = Float.parseFloat(src.getProperty("image_height").
                                               toString());            // 倍率の割り出し | fit diameter
            float srcScale = srcWidth / srcHeight;            float tagWidth = 0, tagHeight = 0;
            if (srcScale < IMAGE_SCALE) {
                tagHeight = srcHeight > IMAGE_HEIGHT ? IMAGE_HEIGHT : srcHeight;
                tagWidth = tagHeight * srcScale;            }
            else {
                tagWidth = srcWidth > IMAGE_WIDTH ? IMAGE_WIDTH : srcWidth;
                tagHeight = tagWidth / srcScale;
            }            float xScale = (float) tagWidth / srcWidth;
            float yScale = (float) tagHeight / srcHeight;            // サイズを変更 | change the size use java.awt.image.render.ParameterBlock
            ParameterBlock pb = new ParameterBlock();
            pb.addSource(src);
            //--modify--
            //---new---
            pb.add(xScale); //width scale
            pb.add(yScale); //height scale
            //---end---
            pb.add(0.0F);
            pb.add(0.0F);
            src = JAI.create("scale", pb, null);            // エンコード |encode
            RenderedOp small = JAI.create("encode", src, output, "PNG", null);
            output.flush();
            return true;
        }
        catch (Exception e) {
            return false;
        }    }