Android Question Image Orientation

nicieri

Active Member
Licensed User
Longtime User
B4X:
                Dim imgData As Map = Images.Get(url)
                img = imgData.Get("image")


I want to load a BMP into my B4XImage object in B4A with the following code, but an image that should be vertical is displayed horizontally. This only happens with some images. In B4i, the same code works perfectly; it's as if iOS always handles it correctly, but B4A does not. I tried getting the image orientation from the data and then rotating it, but it sometimes fails. What could be the best solution?

- Should I keep trying the option of rotating it? Or maybe B4XImage already solves it in a way I haven't found? This only happens with some images.

Thanks.
 

nicieri

Active Member
Licensed User
Longtime User
Thanks Erel,


I'm trying with that one, I even updated my 'xImageSliderIG' code so that it works with that library, but it gives me this error:

'ResponseError. Reason: Forbidden, Response:'

If I do it directly, the link is accessible and functional, even in the other way if it gives me the image.
 
Upvote 0

nicieri

Active Member
Licensed User
Longtime User
I tryed also 'HU2_PUBLIC, but i get the same error: 'ResponseError. Reason: Forbidden, Response:'
 
Upvote 0

nicieri

Active Member
Licensed User
Longtime User
But if I do it directly with SMM from the URLs, I should be able to download it directly, right? Without saving them to the device, that's what it's for, isn't it?
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
?
B4X:
'Similar to SetMediaWithExtra. Loads a local file. The Mime type must be set.
'This is different than AddLocalMedia where the media is directly added to the cache.
'Use this method to display local resources. Use AddLocalMedia to add error / loading resources.
Public Sub SetMediaFromFile(Target As B4XView, Dir As String, FileName As String, Mime As String, Extra As Map)
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
According to the first post, there is a problem with the orientation of the .BMP images. You can check the orientation of the image before uploading it by checking its header.

Why don't you upload a project to see what you want to do?
 
Upvote 0
Top