@Override
    public Resource<byte[]> transcode(Resource<Bitmap> toTranscode) {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        toTranscode.get().compress(compressFormat, quality, os);
        toTranscode.recycle();
        return new BytesResource(os.toByteArray());
    }
An {@link ResourceTranscoder} that converts
{@link Bitmap}s into byte arrays using
{@link Bitmap#compress(Bitmap.CompressFormat, int, java.io.OutputStream)}.
core/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoder.java