Skip to content

JPEGEncoder

Nick Ryzhy edited this page Apr 3, 2016 · 9 revisions

Encodes image data using JPEG compression algorithm.

Name Value
Package by.blooddy.crypto.image
Name final class JPEGEncoder
Inheritance JPEGEncoderProcessEventDispatcherObject

Examples

Sync
import by.blooddy.crypto.Base64;
var result:ByteArray = Base64.decode( 'ZWFzdXJlLg==' );
Async
import by.blooddy.crypto.JPEGEncoder;
import by.blooddy.crypto.events.ProcessEvent;

var jpeg:JPEGEncoder= new JPEGEncoder();
jpeg.decode( bytes );
jpeg.addEventListener( ProcessEvent.COMPLETE, function(event:ProcessEvent):void {
	var result:ByteArray = event.data;
	trace( result ); // async result
} );
jpeg.addEventListener( ProcessEvent.ERROR, function(event:ProcessEvent):void {
	var error:Error = event.data;
	trace( error ); // async error
} );

Static Methods

Name Description
encode(image:BitmapData, quality:uint=60):ByteArray Creates a JPEG image from the specified BitmapData. Used BitmapData.encode(), if posible.
encodeBytes(bytes:ByteArray, width:uint, height:uint, quality:uint=60):ByteArray Creates a JPEG image from the specified ByteArray.

Name Description
function JPEGEncoder() Creates a JPEGEncoder object.

Methods

Name Description
encode(image:BitmapData, quality:uint=60):ByteArray Asynchronously creates a JPEG image from the specified BitmapData. Dispatched sequence of bytes in ProcessEvent.
encodeBytes(bytes:ByteArray, width:uint, height:uint, quality:uint=60):ByteArray Asynchronously creates a JPEG image from the specified ByteArray. Dispatched sequence of bytes in ProcessEvent.

Events

Name Type Description
complete ProcessEvent Dispatched when success.
error ProcessEven Dispatched when fault.

Hashsum

Checksum

Image

Serialization

Clone this wiki locally