Class 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 to UploadRequest.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 using PreprocessChain.loadWith(ResourceDecoder) and PreprocessChain.saveWith(ResourceEncoder).
    • 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 ImagePreprocessChain limitDimensionsChain​(int maxWidth, int maxHeight)
      Convenience method for building an efficient dimension limiting chain using BitmapDecoder and Limit.
      • Methods inherited from class com.cloudinary.android.preprocess.PreprocessChain

        addStep, execute, isEmpty, loadWith, saveWith
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImagePreprocessChain

        public ImagePreprocessChain()
    • Method Detail

      • limitDimensionsChain

        public static ImagePreprocessChain limitDimensionsChain​(int maxWidth,
                                                                int maxHeight)
        Convenience method for building an efficient dimension limiting chain using BitmapDecoder and Limit. Use this in UploadRequest.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:
        getDefaultEncoder in class com.cloudinary.android.preprocess.PreprocessChain<android.graphics.Bitmap>
      • getDefaultDecoder

        protected com.cloudinary.android.preprocess.ResourceDecoder<android.graphics.Bitmap> getDefaultDecoder()
        Specified by:
        getDefaultDecoder in class com.cloudinary.android.preprocess.PreprocessChain<android.graphics.Bitmap>