I need to load a bitmap, that is in the file system, into byte array to upload it but needs to be:
I can do it with glide
Glide.with(context)
    .load(“/user/profile/photo/path”)
    .asBitmap()
    .toBytes()
    .centerCrop()
    .into(new SimpleTarget<byte[]>(250, 250) {
        @Override
        public void onResourceReady(byte[] data, GlideAnimation anim) {
            // Post your bytes to a background thread and upload them here.
        }
    });
but I dont want to include it just for that. Any way to do it with picasso?
Try this solution
Bitmap bmp = intent.getExtras().get("data"); 
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); 
byte[] byteArray = stream.toByteArray();
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With