Class BitmapEncoder
java.lang.Object
com.bumptech.glide.load.resource.bitmap.BitmapEncoder
- All Implemented Interfaces:
Encoder<Resource<Bitmap>>,ResourceEncoder<Bitmap>
An
ResourceEncoder that writes Bitmaps
to OutputStreams.
Bitmaps that return true from ()} are written using Bitmap.CompressFormat.PNG to preserve alpha and
all other bitmaps are written using Bitmap.CompressFormat.JPEG.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Option<Bitmap.CompressFormat>AnBitmap.CompressFormatoption used as the format to encode theBitmap.An integer option between 0 and 100 that is used as the compression quality. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWrites the given data to the given output stream and returns True if the write completed successfully and should be committed.getEncodeStrategy(Options options)
-
Field Details
-
COMPRESSION_QUALITY
An integer option between 0 and 100 that is used as the compression quality.Defaults to 90.
-
COMPRESSION_FORMAT
AnBitmap.CompressFormatoption used as the format to encode theBitmap.Defaults to
Bitmap.CompressFormat.JPEGfor images without alpha andBitmap.CompressFormat.PNGfor images with alpha.
-
-
Constructor Details
-
BitmapEncoder
-
BitmapEncoder
Deprecated.UseBitmapEncoder(ArrayPool)instead.
-
-
Method Details
-
encode
public boolean encode(@NonNull Resource<Bitmap> resource, @NonNull File file, @NonNull Options options) Description copied from interface:EncoderWrites the given data to the given output stream and returns True if the write completed successfully and should be committed. -
getEncodeStrategy
- Specified by:
getEncodeStrategyin interfaceResourceEncoder<Bitmap>
-
BitmapEncoder(ArrayPool)instead.