Package com.alibaba.simpleimage.render

Examples of com.alibaba.simpleimage.render.WriteRender


        try {
            inStream = new FileInputStream(in);
            outStream = new FileOutputStream(out);
            ImageRender rr = new ReadRender(inStream, toRGB);
            ImageRender sr = new ScaleRender(rr, scaleParam);
            wr = new WriteRender(sr, outStream, format);
            wr.render();
        } finally {
            IOUtils.closeQuietly(inStream);
            IOUtils.closeQuietly(outStream);
            if (wr != null) {
View Full Code Here


            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();
        } catch (Exception e) {
            errorLog(inputStream);
View Full Code Here

        return param;
    }

    protected void write(ImageRender dr) throws SimpleImageException, IOException {
        ImageRender wr = new WriteRender(dr, rpath.getCanonicalPath() + File.separator
                                             + "DRAWTEXT_334.jpg");
        wr.render();
        wr.dispose();
    }
View Full Code Here

                    dp.addTextInfo(itm);
                }
            }
            DrawTextRender dtr = new DrawTextRender(rr, dp);

            fr = new WriteRender(dtr, new File(rpath, "DRAWTEXT_" + desc + imageName.substring(0, imageName.lastIndexOf("."))
                                                      + ".jpg"));
            fr.render();
        } finally {
            IOUtils.closeQuietly(in);
            if (fr != null) {
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);
           
            if(wr != null) {
                wr.dispose();
            }
        }
    }
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 {
            IOUtils.closeQuietly(inStream);
           
            if(wr != null) {
                wr.dispose();
            }
        }
    }
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);
                } else if ("Bilinear".equalsIgnoreCase(name)) {
                    img = doScaleBilinear(img);
                } else if ("Bicubic".equalsIgnoreCase(name)) {
                    img = doScaleBicubic(img);
                } else if ("Bicubic2".equalsIgnoreCase(name)) {
                    img = doScaleBicubic2(img);
                } else if ("SubsampleAverage".equalsIgnoreCase(name)) {
                    img = doSubsampleAverage(img);
                } else if ("lanczos".equalsIgnoreCase(name)){
                    img = doLanczos(img);
                } else {
                    throw new IllegalArgumentException("Unknown alg " + name);
                }

                wi.setImage(img);
                wr = new WriteRender(wi, out);

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

                continue;
            }
           
            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);
                IOUtils.closeQuietly(out);
            }
        }
View Full Code Here

        OutputStream output = null;
        ImageRender wr = null;

        try {
            output = new FileOutputStream(new File(resultDir, filename));
            wr = new WriteRender(sr, output, ImageFormat.JPEG);
            wr.render();
        } finally {
            if (wr != null) {
                wr.dispose();
            }
View Full Code Here

        OutputStream output = null;
        ImageRender wr = null;

        try {
            output = new FileOutputStream(new File(resultDir, filename));
            wr = new WriteRender(sr, output, ImageFormat.JPEG);
            wr.render();
        } finally {
            if (wr != null) {
                wr.dispose();
            }
View Full Code Here

TOP

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

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.