Package com.alibaba.simpleimage.render

Examples of com.alibaba.simpleimage.render.ReadRender


    void doTest(File dir, File wmDir, String bg, String wm, float alpha, int x, int y) throws Exception {
        InputStream in = null;
        ImageRender sr = null;
        try {
            in = new FileInputStream(new File(dir, bg));
            ImageRender rr = new ReadRender(in, true);
            sr = new WatermarkRender(rr, createParam(wmDir, wm, alpha, x, y));
            write(sr, alpha + "-result-" + bg);
        } finally {
            if (sr != null) {
                sr.dispose();
View Full Code Here


        InputStream in = null;
        ImageRender rr = null;
        ImageWrapper imageWrapper = null;
        try {
            in = new FileInputStream(new File(dir, imgPath));
            rr = new ReadRender(in, false);
            imageWrapper = rr.render();
        } finally {
            if (rr != null) {
                rr.dispose();
            }
View Full Code Here

   
    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);
View Full Code Here

    public ImageWrapper read(File file) throws Exception {
        ImageRender rr = null;
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            rr = new ReadRender(in);
           
            return rr.render();
        } finally {
            IOUtils.closeQuietly(in);
            if(rr != null) {
View Full Code Here

        FileOutputStream outStream = null;
        ImageRender wr = null;
        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);
View Full Code Here

        File resultFile = new File(resultDir, destName);

        try {
            File f = new File(dir, sourceName);
            in = new FileInputStream(f);
            ReadRender rr = new ReadRender(in);

            DrawTextParameter dp = new DrawTextParameter();
            dp.addTextInfo(new FixDrawTextItem("1234554321"));
            DrawTextRender dtr = new DrawTextRender(rr, dp);
            // scale
View Full Code Here

                    ImageRender wr = null;
                    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();
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);
View Full Code Here

        FileInputStream in = null;
        FileInputStream in2 = null;
        try {
            in = new FileInputStream(dest);
            in2 = new FileInputStream(src);
            ImageRender rr = new ReadRender(in, false);
            ImageRender rr2 = new ReadRender(in2, false);
            ImageWrapper srcImg = rr2.render();
            ImageWrapper dstImg = rr.render();
            BufferedImage dstBi = dstImg.getAsBufferedImage();

            assertTrue(dstBi.getColorModel().getColorSpace().isCS_sRGB());
            assertTrue(dstBi.getWidth() <= 1024);
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.