Package com.alibaba.simpleimage.io

Examples of com.alibaba.simpleimage.io.ByteArrayOutputStream


            rootDir = imgDir;
        }

        FileInputStream inputStream = new FileInputStream(new File(rootDir, filename));

        ByteArrayOutputStream temp = new ByteArrayOutputStream();
        IOUtils.copy(inputStream, temp);
        IOUtils.closeQuietly(inputStream);

        InputStream img = temp.toInputStream();
        temp = null;

        System.out.println("***********Performance Test**************");

        for (int i = 0; i < frequency; i++) {
View Full Code Here


        return null;
    }

    public static InputStream createMemoryStream(InputStream input) throws IOException {
        if ((!(input instanceof ByteArrayInputStream)) && (!(input instanceof java.io.ByteArrayInputStream))) {
            ByteArrayOutputStream temp = new ByteArrayOutputStream();
            IOUtils.copy(input, temp);

            input = temp.toInputStream();
            temp = null;
        }

        return input;
    }
View Full Code Here

     * @throws IOException
     */
    public OutputStream process(InputStream inputStream, DrawTextParameter drawParam, int maxWidth, int maxHeight)
                                                                                                                  throws SimpleImageException {
        ImageRender wr = null;
        ByteArrayOutputStream output = null;

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

    }

    public void doScale(File rootDir, String imgName, Scaler scaler, int times, float scale) throws Exception {
        FileInputStream inputStream = new FileInputStream(new File(rootDir, imgName));

        ByteArrayOutputStream temp = new ByteArrayOutputStream();
        IOUtils.copy(inputStream, temp);
        IOUtils.closeQuietly(inputStream);

        InputStream img = temp.toInputStream();
        temp = null;

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

View Full Code Here

                    imgs.add(f);
                }
                for(File imgFile : imgs) {
                    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));
                       
View Full Code Here

TOP

Related Classes of com.alibaba.simpleimage.io.ByteArrayOutputStream

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.