Package com.lightcrafts.image.libs

Examples of com.lightcrafts.image.libs.LCJPEGWriter


            if ( colorSpace == CS_UNKNOWN )
                throw new LCImageLibException(
                    "Unsupported number of components: " + numComponents
                );

            final LCJPEGWriter writer = new LCJPEGWriter(
                options.getExportFile().getPath(),
                image.getWidth(), image.getHeight(),
                numComponents, colorSpace,
                jpegOptions.quality.getValue(),
                jpegOptions.resolution.getValue(),
                jpegOptions.resolutionUnit.getValue()
            );

            ICC_Profile profile = ColorProfileInfo.getExportICCProfileFor(
                jpegOptions.colorProfile.getValue()
            );
            if ( profile == null )
                profile = JAIContext.sRGBExportColorProfile;
            writer.setICCProfile( profile );

            if ( lznDoc != null ) {
                final byte[] buf = XMLUtil.encodeDocument( lznDoc, false );
                writer.writeSegment( JPEG_APP4_MARKER, buf );
            }

            writer.putMetadata( metadata );
            writer.putImage( image, thread );
        }
        catch ( LCImageLibException e ) {
            final IOException ioe = new IOException( "JPEG export failed" );
            ioe.initCause( e );
            throw ioe;
View Full Code Here


        try {
            final OutputStream out = cache.putToStream(key);
            final OutputStreamImageDataReceiver receiver =
                new OutputStreamImageDataReceiver(out);
            try {
                final LCJPEGWriter writer = new LCJPEGWriter(
                    receiver, 32 * 1024,
                    image.getWidth(), image.getHeight(),
                    image.getColorModel().getNumComponents(),
                    CS_RGB, 90
                );
                writer.putImage(image);
                writer.dispose();
            }
            catch (LCImageLibException e) {
                logNonFatalStatic(file, e, "caching preview");
                cache.remove(key);
            }
View Full Code Here

        try {
            final OutputStream out = cache.putToStream(key);
            OutputStreamImageDataReceiver receiver =
                new OutputStreamImageDataReceiver(out);
            try {
                final LCJPEGWriter writer = new LCJPEGWriter(
                    receiver, 32 * 1024,
                    image.getWidth(), image.getHeight(),
                    image.getColorModel().getNumComponents(),
                    CS_RGB, 90
                );
                writer.putImage(image);
                writer.dispose();
            }
            catch (LCImageLibException e) {
                logNonFatal(e, "caching preview");
                cache.remove(key);
            }
View Full Code Here

TOP

Related Classes of com.lightcrafts.image.libs.LCJPEGWriter

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.