MrKim Well-Known Member Licensed User Longtime User Nov 23, 2019 #1 What am I missing?? Here is my code Code: II.SetLayout(0, 0, PH, PW) II.Gravity = Gravity.FILL II.Bitmap = LoadBitmapResize(Dir, FileName, PW, PH, True) P.AddView(II, 0, 0, PW, PH) This is how it looks when viewed with Photos. And this is how it looks when loaded into an image view. Notice I have reversed Height and width on some of these. I have tried changing the gravity and reversing the height and width in any number of combinations to no avail. here are the specs on the picture. It appears that the issue is with all pictures taken in portrait mode. Pictures taken in landscape mode load ok. Attachments upload_2019-11-23_7-20-41.png 95.1 KB · Views: 684 upload_2019-11-23_7-21-21.png 104.1 KB · Views: 698
What am I missing?? Here is my code Code: II.SetLayout(0, 0, PH, PW) II.Gravity = Gravity.FILL II.Bitmap = LoadBitmapResize(Dir, FileName, PW, PH, True) P.AddView(II, 0, 0, PW, PH) This is how it looks when viewed with Photos. And this is how it looks when loaded into an image view. Notice I have reversed Height and width on some of these. I have tried changing the gravity and reversing the height and width in any number of combinations to no avail. here are the specs on the picture. It appears that the issue is with all pictures taken in portrait mode. Pictures taken in landscape mode load ok.
S sorex Expert Licensed User Longtime User Nov 23, 2019 #2 I believe that android's default image handling doesn't take the rotation info into account that is sometimes added to the image header (by cameras?). Upvote 0
I believe that android's default image handling doesn't take the rotation info into account that is sometimes added to the image header (by cameras?).
agraham Expert Licensed User Longtime User Nov 23, 2019 #3 ImageView displays a Bitmap and Bitmaps don't carry any orientation data as LoadBitmap seems to ignore it. You probably need to rotate the Bitmap of the image according to the EXIF orientation data in the original jpg image file. You should be able to get this using this library https://www.b4x.com/android/forum/threads/android-support-exifinterface.74629/#content Png files don't usually carry orientation information. Upvote 0
ImageView displays a Bitmap and Bitmaps don't carry any orientation data as LoadBitmap seems to ignore it. You probably need to rotate the Bitmap of the image according to the EXIF orientation data in the original jpg image file. You should be able to get this using this library https://www.b4x.com/android/forum/threads/android-support-exifinterface.74629/#content Png files don't usually carry orientation information.
MrKim Well-Known Member Licensed User Longtime User Nov 24, 2019 #4 agraham said: ImageView displays a Bitmap and Bitmaps don't carry any orientation data as LoadBitmap seems to ignore it. You probably need to rotate the Bitmap of the image according to the EXIF orientation data in the original jpg image file. You should be able to get this using this library https://www.b4x.com/android/forum/threads/android-support-exifinterface.74629/#content Png files don't usually carry orientation information. Click to expand... You would think that the first number would be x and the second y (or vice versa)? I mean ContnetChooser knows which way the picture is oriented. Where does it get its information? Upvote 0
agraham said: ImageView displays a Bitmap and Bitmaps don't carry any orientation data as LoadBitmap seems to ignore it. You probably need to rotate the Bitmap of the image according to the EXIF orientation data in the original jpg image file. You should be able to get this using this library https://www.b4x.com/android/forum/threads/android-support-exifinterface.74629/#content Png files don't usually carry orientation information. Click to expand... You would think that the first number would be x and the second y (or vice versa)? I mean ContnetChooser knows which way the picture is oriented. Where does it get its information?
agraham Expert Licensed User Longtime User Nov 24, 2019 #5 From ContentChooser documentation https://www.b4x.com/android/help/phone.html#contentchooser The ContentChooser object allows the user to select a specific type of content using other installed applications. For example the user can use the internal Gallery application to select an image. Click to expand... ContentChooser doesn't know, it is the application you choose that does. In my experience cameras always save the image in the same orientation relative to the camera. The camera software then uses the device rotation sensor to tag the orientation as landscape or portrait in the EXIF data of the image. This lets the image decoder software orient the image correctly for display. Upvote 0
From ContentChooser documentation https://www.b4x.com/android/help/phone.html#contentchooser The ContentChooser object allows the user to select a specific type of content using other installed applications. For example the user can use the internal Gallery application to select an image. Click to expand... ContentChooser doesn't know, it is the application you choose that does. In my experience cameras always save the image in the same orientation relative to the camera. The camera software then uses the device rotation sensor to tag the orientation as landscape or portrait in the EXIF data of the image. This lets the image decoder software orient the image correctly for display.
MrKim Well-Known Member Licensed User Longtime User Nov 24, 2019 #6 agraham said: From ContentChooser documentation https://www.b4x.com/android/help/phone.html#contentchooser ContentChooser doesn't know, it is the application you choose that does. In my experience cameras always save the image in the same orientation relative to the camera. The camera software then uses the device rotation sensor to tag the orientation as landscape or portrait in the EXIF data of the image. This lets the image decoder software orient the image correctly for display. Click to expand... I'm just trying to understand here. If ContentChooser doesn't know then why are images always displayed correctly? Some have X>y and some have y>x but content chooser always displays them oriented correctly. And in a view that is sized correctly? This just doesn't make sense to me. Upvote 0
agraham said: From ContentChooser documentation https://www.b4x.com/android/help/phone.html#contentchooser ContentChooser doesn't know, it is the application you choose that does. In my experience cameras always save the image in the same orientation relative to the camera. The camera software then uses the device rotation sensor to tag the orientation as landscape or portrait in the EXIF data of the image. This lets the image decoder software orient the image correctly for display. Click to expand... I'm just trying to understand here. If ContentChooser doesn't know then why are images always displayed correctly? Some have X>y and some have y>x but content chooser always displays them oriented correctly. And in a view that is sized correctly? This just doesn't make sense to me.
agraham Expert Licensed User Longtime User Nov 24, 2019 #7 agraham said: ContentChooser doesn't know, it is the application you choose that does. Click to expand... Upvote 0
agraham said: ContentChooser doesn't know, it is the application you choose that does. Click to expand...