Package com.alibaba.simpleimage.render

Examples of com.alibaba.simpleimage.render.ReadRender


            inputStream = ImageUtils.createMemoryStream(inputStream);
            output = new ByteArrayOutputStream();
            ImageFormat outputFormat = ImageUtils.isGIF(inputStream) ? ImageFormat.GIF : ImageFormat.JPEG;
            ScaleParameter scaleParam = new ScaleParameter(maxWidth, maxHeight, Algorithm.AUTO);

            ImageRender rr = new ReadRender(inputStream, true);
            ImageRender dtr = new DrawTextRender(rr, drawParam);
            ImageRender sr = new ScaleRender(dtr, scaleParam);
            wr = new WriteRender(sr, output, outputFormat);

            wr.render();
View Full Code Here


        InputStream in = null;
        ImageRender fr = null;

        try {
            in = new FileInputStream(new File(path, imageName));
            ImageRender rr = new ReadRender(in);

            DrawTextParameter dp = new DrawTextParameter();
            if (items != null) {
                for (DrawTextItem itm : items) {
                    dp.addTextInfo(itm);
View Full Code Here

        System.out.println("***********Scale Performance Test**************");
        long start = 0L, end = 0L, total = 0L;

        img.reset();

        ReadRender rr = new ReadRender(img, false);
        ImageWrapper wi = rr.render();
        BufferedImage bi = wi.getAsBufferedImage();
       
        for (int i = 0; i < times; i++) {     
            start = System.currentTimeMillis();
            PlanarImage zoomOp = scaler.doScale(PlanarImage.wrapRenderedImage(bi), scale);
View Full Code Here

    static String correctImageDir = "./src/test/resources/conf.test/simpleimage/scale/";

    private ImageWrapper readImage(String path) throws Exception {
        File file = new File(path);
        InputStream inStream = new FileInputStream(file);
        ReadRender rr = new ReadRender(inStream, false);
        try {
            return rr.render();
        } finally {
            if (inStream != null) {
                inStream.close();
            }

            if (rr != null) {
                rr.dispose();
            }
        }
    }
View Full Code Here

   
    void doColorQuant(File in, File out, WriteParameter.QuantAlgorithm quantAlg) throws Exception {
        WriteRender wr = null;
        InputStream inStream = new FileInputStream(in);
        try {
            ReadRender rr = new ReadRender(inStream);
            wr = new WriteRender(rr, out, ImageFormat.GIF, new WriteParameter(quantAlg));
           
            wr.render();
        } finally {
            IOUtils.closeQuietly(inStream);
View Full Code Here

   
    void doScaleWork(File in, boolean toRGB, File out, ImageFormat format) throws Exception {
        WriteRender wr = null;
        InputStream inStream = new FileInputStream(in);
        try {
            ReadRender rr = new ReadRender(inStream, toRGB);
            ScaleRender sr = new ScaleRender(rr, new ScaleParameter(100, 100));
            wr = new WriteRender(sr, out, format);
           
            wr.render();
        } finally {
View Full Code Here

            String filename = imgFile.getName().substring(0, imgFile.getName().lastIndexOf("."));
            InputStream in = new FileInputStream(imgFile);
            OutputStream out = new FileOutputStream(new File(resultDir, "SCALE_" + filename + "-" + name + ".jpg"));
            WriteRender wr = null;
            try {
                ReadRender rr = new ReadRender(in, true);

                ImageWrapper wi = rr.render();
                PlanarImage img = wi.getAsPlanarImage();
                if ("progbicu".equalsIgnoreCase(name)) {
                    img = doProgressiveBicubic(img);
                } else if ("Nearest".equalsIgnoreCase(name)) {
                    img = doScaleNearest(img);
View Full Code Here

           
            InputStream in = new FileInputStream(imgFile);
            OutputStream out = new FileOutputStream(new File(resultDir, "QUALITY_" + imgFile.getName()));
            WriteRender wr = null;
            try {
                ReadRender rr = new ReadRender(in, true);
                wr = new WriteRender(rr, out);

                wr.render();
            } finally {
                IOUtils.closeQuietly(in);
View Full Code Here

    }
   
    public ImageWrapper readImage(File dir, String filename) throws Exception{
        InputStream in = new FileInputStream(new File(dir, filename));
        try {
            ReadRender rr = new ReadRender(in, true);
           
            return rr.render();
        }finally{
            IOUtils.closeQuietly(in);
        }
    }
View Full Code Here

        InputStream in = null;
        ImageWrapper srcImageWrapper = null;
        ImageRender rr = null;
        try {
            in = new FileInputStream(new File(path, "cb.GIF"));
            rr = new ReadRender(in, true);
            srcImageWrapper = rr.render();
        } finally {
            if (rr != null) {
                rr.dispose();
            }
            IOUtils.closeQuietly(in);
        }
       
        int width = srcImageWrapper.getWidth();
        int height = srcImageWrapper.getHeight();
       
        ImageWrapper wmImage = null;
        ImageRender sr = null;
        try {
            in = new FileInputStream(new File(path, "alibaba1.gif"));
            rr = new ReadRender(in, false);
            sr = new ScaleRender(rr, new ScaleParameter(width, height, ScaleParameter.Algorithm.SUBSAMPLE_AVG));
            wmImage = sr.render();
        } finally {
            if (sr != null) {
                sr.dispose();
View Full Code Here

TOP

Related Classes of com.alibaba.simpleimage.render.ReadRender

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.