當前位置: 首頁>>代碼示例>>Java>>正文


Java JPEGCodec.createJPEGDecoder方法代碼示例

本文整理匯總了Java中com.sun.image.codec.jpeg.JPEGCodec.createJPEGDecoder方法的典型用法代碼示例。如果您正苦於以下問題:Java JPEGCodec.createJPEGDecoder方法的具體用法?Java JPEGCodec.createJPEGDecoder怎麽用?Java JPEGCodec.createJPEGDecoder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.image.codec.jpeg.JPEGCodec的用法示例。


在下文中一共展示了JPEGCodec.createJPEGDecoder方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseJPGImage

import com.sun.image.codec.jpeg.JPEGCodec; //導入方法依賴的package包/類
public void parseJPGImage() { // read the embedded jpeg image
    try {
        JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(stream);
        image = decoder.decodeAsBufferedImage();
        int motionLevel = motionDetector.enqueueImage(image);
        plugin.setMotionLevel(motionLevel);
    } catch (Exception e) {
        e.printStackTrace();
        disconnect();
    }
}
 
開發者ID:freedomotic,項目名稱:freedomotic,代碼行數:12,代碼來源:MjpegWebcamConnector.java

示例2: decodeJPEG

import com.sun.image.codec.jpeg.JPEGCodec; //導入方法依賴的package包/類
/**
 * Decode a buffer of data into a Raster with the specified location.
 *
 * @param data buffer contain an interchange or abbreviated datastream.
 * @param decodeParam decoding parameters; may be null unless the
 *        data buffer contains an abbreviated datastream in which case
 *        it may not be null or an error will occur.
 * @param colorConvert whether to perform color conversion; in this
 *        case that would be limited to YCbCr-to-RGB.
 * @param minX the X position of the returned Raster.
 * @param minY the Y position of the returned Raster.
 */
private static final Raster decodeJPEG(byte[] data,
                                       JPEGDecodeParam decodeParam,
                                       boolean colorConvert,
                                       int minX,
                                       int minY) {
    // Create an InputStream from the compressed data array.
    ByteArrayInputStream jpegStream = new ByteArrayInputStream(data);

    // Create a decoder.
    JPEGImageDecoder decoder = decodeParam == null ?
        JPEGCodec.createJPEGDecoder(jpegStream) :
        JPEGCodec.createJPEGDecoder(jpegStream,
                                    decodeParam);

    // Decode the compressed data into a Raster.
    Raster jpegRaster;
    try {
        jpegRaster = colorConvert ?
            decoder.decodeAsBufferedImage().getWritableTile(0, 0) :
            decoder.decodeAsRaster();
    } catch (IOException ioe) {
        throw new RuntimeException("TIFFImage13");
    }

    // Translate the decoded Raster to the specified location and return.
    return jpegRaster.createTranslatedChild(minX, minY);
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:40,代碼來源:TIFFImage.java

示例3: load

import com.sun.image.codec.jpeg.JPEGCodec; //導入方法依賴的package包/類
static public BufferedImage load(InputStream stream) 
//----------------------------------------------
{
	BufferedImage image = null;
	try {
		JPEGImageDecoder decoder=JPEGCodec.createJPEGDecoder(stream);
		image = decoder.decodeAsBufferedImage();
	}
	catch (Exception e) {e.printStackTrace();}
	return image;
}
 
開發者ID:krevelen,項目名稱:coala,代碼行數:12,代碼來源:JPEGUtilities.java


注:本文中的com.sun.image.codec.jpeg.JPEGCodec.createJPEGDecoder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。