Class ImagePreprocessChain
- java.lang.Object
-
- com.cloudinary.android.preprocess.PreprocessChain<android.graphics.Bitmap>
-
- com.cloudinary.android.preprocess.ImagePreprocessChain
-
public class ImagePreprocessChain extends com.cloudinary.android.preprocess.PreprocessChain<android.graphics.Bitmap>A preprocess chain to run on images before uploading. Pass an instance of a populated chain toUploadRequest.preprocess(PreprocessChain). The processing steps will run by the order in which they were added to the chain. This chain uses the default Bitmap encoder/decoder, however custom implementations can be supplied usingPreprocessChain.loadWith(ResourceDecoder)andPreprocessChain.saveWith(ResourceEncoder).
-
-
Constructor Summary
Constructors Constructor Description ImagePreprocessChain()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.cloudinary.android.preprocess.ResourceDecoder<android.graphics.Bitmap>getDefaultDecoder()protected com.cloudinary.android.preprocess.ResourceEncoder<android.graphics.Bitmap>getDefaultEncoder()static ImagePreprocessChainlimitDimensionsChain(int maxWidth, int maxHeight)Convenience method for building an efficient dimension limiting chain usingBitmapDecoderandLimit.
-
-
-
Method Detail
-
limitDimensionsChain
public static ImagePreprocessChain limitDimensionsChain(int maxWidth, int maxHeight)
Convenience method for building an efficient dimension limiting chain usingBitmapDecoderandLimit. Use this inUploadRequest.preprocess(PreprocessChain). The scaling retains the original aspect ratio while guaranteeing the height and width are within the requested maximum bounds. Note: If the image is already smaller it will be returned unchanged.- Parameters:
maxWidth- The maximum width allowed. If the width of the image is greater, the image will be resized accordingly.maxHeight- The maximum height allowed. If the height of the image is greater, the image will be resized accordingly.- Returns:
- The prepared chain to pass on to
UploadRequest.preprocess(PreprocessChain)
-
getDefaultEncoder
protected com.cloudinary.android.preprocess.ResourceEncoder<android.graphics.Bitmap> getDefaultEncoder()
- Specified by:
getDefaultEncoderin classcom.cloudinary.android.preprocess.PreprocessChain<android.graphics.Bitmap>
-
getDefaultDecoder
protected com.cloudinary.android.preprocess.ResourceDecoder<android.graphics.Bitmap> getDefaultDecoder()
- Specified by:
getDefaultDecoderin classcom.cloudinary.android.preprocess.PreprocessChain<android.graphics.Bitmap>
-
-