0

I am using Glide library on Android to load a JPG format image into an ImageView, first I convert it to a ByteArray and then I use the following code:

GlideApp.with(context)
                .load(selectedImageByteArray)
                .into(image_view)

However, when the selected image orientation EXIF data is equal to "Rotate 270 CW" the image is not rotated by Glide unless I use the following code:

GlideApp.with(context)
                .load(selectedImagePath)
                .into(image_view)

This way I pass the selected image Uri instead of a ByteArray, why does this happen?

I attach and example (even here in Stack is not rotated): enter image description here

glisu
  • 1,027
  • 10
  • 20
  • "first I convert it to a ByteArray" -- I do not know why you do this. But, in terms of your question, *how* do you do this? – CommonsWare Apr 06 '19 at 19:48

1 Answers1

0

Because that interface takes a path and nothing else. Kind of annoying since depending on the api level it is not always available. In some of the newer versions of android it is not easy to get the actual path of the file.image data for that The short answer is that the data that interface uses is stored in the file, not in the image data itself. There are many stack overflow links about this:

SO