Package com.alibaba.simpleimage.render

Examples of com.alibaba.simpleimage.render.WriteRender


    public void doReadWrite(File in, File out, ImageFormat format) throws Exception {
        doReadWrite(in, true, out, format);
    }
   
    public void doReadWrite(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);
            wr = new WriteRender(rr, out, format);
           
            wr.render();
        } finally {
            IOUtils.closeQuietly(inStream);
           
            if(wr != null) {
                wr.dispose();
            }
        }
    }
View Full Code Here


                    ScaleParameter.Algorithm.AUTO);
            ImageRender sr = new ScaleRender(dtr, param);

            output = new FileOutputStream(resultFile);
            ImageFormat outputFormat = sourceName.endsWith("gif") ? ImageFormat.GIF : ImageFormat.JPEG;
            wr = new WriteRender(sr, output, outputFormat);

            wr.render();
        } finally {
            if (wr != null) {
                wr.dispose();
View Full Code Here

                    InputStream inStream = null;
                    OutputStream outStream = new ByteArrayOutputStream();
                    try {
                        inStream = new FileInputStream(imgFile);
                        ImageRender rr = new ReadRender(inStream);
                        wr = new WriteRender(rr, outStream, ImageFormat.GIF, new WriteParameter(quantAlg));
                       
                        wr.render();
                    } catch(Exception e) {
                        e.printStackTrace();
                    } 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, "MALFORMED_" + filename + ".jpg"));
            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

            }
        }
    }

    void scale(ImageWrapper imgWrapper, ScaleParameter param, File output, ImageFormat format) throws Exception {
        WriteRender wr = null;
        try {
            ImageRender sr = new ScaleRender(imgWrapper, param);
            wr = new WriteRender(sr, output, format);

            wr.render();
        } finally {
            if (wr != null) {
                wr.dispose();
            }
        }
    }
View Full Code Here

            }
        }
    }

    void draw(ImageWrapper imgWrapper, DrawTextParameter param, File output, ImageFormat format) throws Exception {
        WriteRender wr = null;
        try {
            ImageRender sr = new DrawTextRender(imgWrapper, param);
            wr = new WriteRender(sr, output, format);

            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.