Thứ Năm, 12 tháng 9, 2013

Rotation and flipping

https://github.com/svenkapudija/Android-Im

Resize

// Different width and height
ImageResizer.resize(myImageFile, 640, 480);

// Choose ResizeMode - FIT_TO_WIDTH, FIT_TO_HEIGHT, FIT_EXACT or AUTOMATIC
ImageResizer.resize(myImageFile, 640, 480, ResizeMode.FIT_TO_WIDTH);

Crop

// Basic croping
ImageResizer.crop(myImageFile, 500, 500);

// Croping with specified starting X and Y point
ImageResizer.crop(myImageFile, 50, 50, 640, 480);

Rotation and flipping

Very memory-intensive for high-resolution images (for ex. 2560*1600), better scale it down and then rotate.
// Rotate an image for 90, 180 or 270 degrees
ImageResizer.rotate(myImageFile, ImageRotation.CW_90);

// Flip an image horizontally or vertically 
ImageResizer.rotate(myImageFile, ImageRotation.FLIP_HORIZONTAL);ageResizer

Không có nhận xét nào:

Đăng nhận xét