Photos poorly oriented when pulled from filepicker

In my application I allow users to take a photo or select an image using the filepicker.  But when she shows the images in an imageView that they appear on the side and never in the correct position, no matter if they were taken without focus lock, or whatever.  When I invoke the display of images, howeverm images are always perfectly oriented.

Is there anything I can do in my code to accommodate for this?  Orientation is off differently isn't tlike it's always oritented left, sometimes it's to the right, sometimes it is upside down, sometimes it's to the left.

Hello

I know exactly what is happening - I'm working on an app photo from last year, and I had the same problem.

When the camera takes a photo, it adds some EXIF metadata in the JPEG file that indicates its "focus".

In my opinion, the BB should add an ImageView option such as "autoOrient" so that it would automatically read and the picture rotates as appropriate before posting, but I don't think such a property exists. Thus, all the developers who want to display pictures must add this logic to their App (inefficient or what?)

The good news is that there is a sample application that shows how to do this.  Take a look at the sample application "photobomber.

I'll copy and paste the relevant code here:

QImage PhotoBomberApp::getRotateImage(const QString imageFilePath)
{
    //Load the image using QImage.
    QImage image = QImage(imageFilePath);

    ExifData *exifData = 0;
    ExifEntry *exifEntry = 0;
    int exifOrientation = 1;

    // Since the image will loose its exif data when its opened in a QImage
    // it has to be manually rotated according to the exif orientation.
    exifData = exif_data_new_from_file(imageFilePath.toLatin1().data());

    // Locate the orientation exif information.
    if (exifData != NULL) {
        for (int i = 0; i < EXIF_IFD_COUNT; i++) {
            exifEntry = exif_content_get_entry(exifData->ifd[i], EXIF_TAG_ORIENTATION);

            // If the entry corresponds to the orientation it will be a non zero pointer.
            if (exifEntry) {
                exifOrientation = exif_get_short(exifEntry->data, exif_data_get_byte_order(exifData));
                break;
            }
        }
    }

    // A transform will be used to rotate the image according to device and exif orientation.
    QTransform transform;

    qDebug() << "Exif data:" << exifOrientation;

    // It's a bit tricky to get the correct orientation of the image. A combination of
    // the way the the device is oriented and what the actual exif data says has to be used
    // in order to rotate it in the correct way.
    switch(exifOrientation) {
        case 1:
            // 0 degree rotation
            break;
        case 3:
            // 180 degree rotation
            transform.rotate(180);
            break;
        case 6:
            // 90 degree rotation
            transform.rotate(90);
            break;
        case 8:
            // 270 degree rotation
            transform.rotate(270);
            break;
        default:
            // Other orientations are mirrored orientations, do nothing.
            break;
    }

    // Perform the rotation of the image before its saved.
    image = image.transformed(transform);

    return image;
}

This code returns you a QImage, so you can or may not know how, then take that and display them in an ImageView. Incase it's useful, here's an example of my application relating to this code:

QImage thisQImage = getRotateImage(...);

bb::ImageData imageData = bb::ImageData::fromPixels(thisQImage.rgbSwapped().bits(), bb::PixelFormat::RGBX, thisQImage.width(), thisQImage.height(), thisQImage.bytesPerLine());

bb::cascades::Image cascadesImage = imageData;

imageView->setImage(cascadesImage);

A final caveat is that doing each of these conversions between types of image data takes a little time, and so if you do it in the main thread of the application, you might or might not slow down the user interface.  I tried to move my loading image in another thread when it is possible, although I found (I think) the conversion in bb::cascades:Image does not work correctly if this isn't in the main thread, so I don't have this part and call setImage in the main thread.

Hope that helps. Here the answer was simpler.

Tags: BlackBerry Developers

Similar Questions

  • Photos not visible when importing from a card using win8

    I can't see my pictures that were imported on the pallet, it shows 201 photos and they are empty, what is wrong. I use 4.3 with Win8.

    John I

    Try this John http://members.lightroomqueen.com/index.php?/Knowledgebase/Article/View/1137/188/how-do-i-change-my-monitor-profile-to-check-whether-its-corrupted

  • Find my friends pulled from the app store

    So yesterday, there was an update pushed to find my friends and Podcasts. So when I try to update it says "my friends is available on IOS." To get to find my friends, get on the App Store on your iOS device. "(it's on my iTunes on my mac).

    So to speak of Apple Support and they say find them my friends and Podcasts was pulled from the App store inexplicably?

    Anyone know what is happening?

    We are not likely to know more about it than an Apple. A proposal, perhaps apps are updated.

  • all of my photos in icloud were removed from the restoration (and did not find the album recently removed to icloud)



    all of my photos in icloud were removed from the restoration (and did not find the album recently removed to icloud)

    The opposite happened to me - in the opposite direction! I found all my pictures from Nokia mobile in icloud on my iPad a few days ago, had no blue cogwheels devices! The two devices + home phone is all about wireless internet of the contract with ORANGE in Europe! They will not help,

    I think my router - put in place by an expatriate for me - is hacked because of the problem. I didn't ask him to change my contract or warn of my move when I did 2 years ago - but he went ahead and made Orange disclose no information telling me his "confidential".

  • Apple TV (gen 3) freezes when Streaming from iTunes

    I have a third generation Apple TV (latest updates OS) on an airport extreme wireless network 802.11ac. When you try to stream from iTunes (latest) on Mavericks (all patches), many videos can take up to five minutes to start playing, and after playing for twenty or thirty minutes, they "freezing" for anywhere from one minute to five minutes before resuming playback. If I was streaming on the internet, I could understand the delay, but it doesn't have much sense when streaming from a local source.

    What I'm trying to listen to are movies and TV shows that have been downloaded on iTunes. On Apple TV, I select 'Machines' and then select 'Movies' or 'TV Shows' and select the movie or TV show to watch. According to the film or television show, they will be either start immediately or that there may be a delay until five minutes before starting to play.

    I restarted the Apple TV and I checked there is nothing cached on the device, so I don't see where any content downloaded on Apple TV, itself might be forced memory.

    I took my two my edge router and my WiFi network and I can verity that Apple TV is streaming on the computer and not from the internet. I also checked that there are no other consequence WiFi activity (NTP updates, updates to the ASP, etc., but without the use of actual data bandwidth) and I checked that iTunes is the only process that consumes any real network, CPU, or the disk on the computer resources is continuous from. I also checked the other devices on the network are also not any bandwidth real WiFi.

    So I'm puzzled. Any idea what's going on here? Why Apple TV freezes? It is really this poor management of its buffers work? (I find that hard to believe!)

    Any ideas on how to debug this yet? Even better, any ideas how solve this problem?

    Thanks in advance!

    JK

    Try via Ethernet

    Test on another network

  • Office jet pro 8600 how default to black ink only when printing from my ipad

    Is it possible to set an option to print the black ink only when printing from my Ipad 2?
    When I use the print icon the only option that shows is double page. I would like to be able to print in black only.
    I can set this option when you print from my pc...

    Hello

    AirPrint does not support black ink only printing, however the HP ePrint app allows it.

    Note that the option is available only for documents (for example Office, PDF, Web pages and emails files), but not for the Photo files.

    You can find the steps to obtain and use the application in the document below:

    http://support.HP.com/us-en/document/c01616126

  • I get emails with pictures and when I send them to others. they open them but the images are not displayed. The photos are there when I send them. Thank you

    I get emails with pictures and when I send them to others. they open
    their place but the images are not displayed. The photos are there when I send a
    them. Thank you

    Make sure that your security software (antivirus) is not blocking attachments.

  • When calling from my iphone, I get a busy signal, but it does not

    Iphone5S: when calling from my Iphone, they get a busy signal, but I do not use it.

    Is do not disturb on? (icon of Crescent Moon in the right line at the top)

  • Hello, my phone pulled from my class at school and it has no data on it, so I did not no how to locate without using find my iphone is there another way I could find as soon as possible

    Hello, my phone pulled from my class at school and it has no data on it, so I did not no how to locate without using find my iphone is there another way I could find as soon as possible

    Go to iCloud.com

    Then sign in with your Apple ID and password, then click the Find iPhone.

    If this does not help, see: If find my iPhone is not activated on your missing device > what to do if your iOS device is lost or stolen

  • Some iPhoto albums appear empty with no sticker and say '0' when I fly over the album, but the photos are there when I double click.

    To start, I read in countless discussions here on iPhoto glitches and patches, so I hope I'm not repeating this question, but I couldn't find the answer anywhere I had a question after question with iPhoto (mainly around several accidents after organizing photos into albums that made the album organization and this issue I describe below) and is considering moving to Adobe Bridge just to have a reliable place to store my photos without worrying about the constant pain. I realize that no program is immune to glitches, but the volume and the frequency that I've had with iPhoto is unmatched (which led me to wonder if it is just a user error, but I honestly can't understand for the life of me). So I describe my current number below, in the hope of resolving the issue so that either A. I can fix and give iPhoto a chance more or B can I ensure that my photos are safe and intact before transfer to another program.

    Some of my iPhoto albums appear empty with no sticker and say '0' when I fly over the album, but the photos are there when I open the album. I have rebuilt the thumbnails, and it has not solved the problem. After the other issues that I had with iPhoto crashes, I made sure that all updates have been installed. Unfortunately, I don't remember if I've rebuilt or repaired the database, but it seems that all my photos are present, all mixed together and some showing in the albums 'empty '. Here's my question: is one problem, other than being boring? And should I switch to another program, or have I missed something?

    A few details:

    • I have rebuilt thumbnails today and it took 5.5 hours. It seems completing without problem, but has not solved the problem.

    • I have my computer fully backed up on an external drive to Seagate drive as Mac OS extended (journaled) as well as iPhoto backed up separately on the drive as well.

    • Looks like I have a "library" and "alias."

    • I use iPhoto to organize my photos. I use Photoshop to edit. I love the feel of iPhoto, but I lost hours and hours trying to organize and solve problems.

    • I use iPhoto 11 version 9.4.3 OSX 10.8.5 / / MacBook Pro processor 2.9 GHz Intel Core i7 Memory 8 GB 1600 MHz DDR3

    More worrying is the issue of the repeated questions. How you use iPhoto and Photoshop together?

    Tabula Rasa:

    Download iPhoto Library Manager and use its function of reconstruction. (In early versions of the Library Manager, this is the file-> control Rebuild. In versions later it is under the menu library.)

    This will create a completely new library. It will then copy (or try) your photos and all associated metadata and versions to this library and as close as possible to what you had in the damaged library fix it. It does this based on the information it finds in the iPhoto sharing mechanism - but it means that things not shared won't be there, so no slide shows, books or calendars, for example - but it should recover all your events, albums and keywords, faces and places.

    Because this process creates a completely new library and does not change your old, it is non-destructive, and if you are not satisfied with the result, you can simply go back to your old.

  • How can I stop Photos to start when I plug my iPod nano?

    How can I stop Photos to start when I plug my iPod nano?  I use mac os x El Capitan 10.11.3 & iTunes 12.3.2.35.

    It takes your iPod nano 5th generation.  If so, this happens because he has a camera.  After Photos opens when you connect iPod, near the top of the window, is there a checkbox to Open the Photos for this device (or words to that effect)?  If you see this checkbox, uncheck.  Photos should be open when the iPod is connected.

  • Satellite A100-049 screen remains empty when reactivated from sleep mode

    Intermittently, have been left for a while my screen A100-049 remains empty when reactivated from sleep mode. It does not meet the access keys and have checked the settings which seem to agree.

    Notice that in this case the power button remains 'blue' and not to return to 'Orange flashing. Is this a common problem?

    Hello

    What do you with the mode 'sleep'? Do you mean the hibernation mode or the mode booth? What operating system do you use?

    Listen buddy. It's really not easy to say why it happens without running diagnostic tests. I think you should try to update the graphics driver and check if you are using the latest version of the BIOS. Two updates might be useful in resolving these issues

    Good luck

  • Why do I have a Spinning beachball when waking from sleep?

    When I wake my OS X 10.6.8 iMac 21.5 "sleep it was very slow and he was/is a spinning beachball before it starts to work.  Thinking that I might have a HD II etresoft failure to evaluate it and got "excellent" condition while speeding up considerably my action of firefox, but the beach ball is still there.

    I read mac extremely slow (at random), memory full, fine CPU

    Then I ran the etresoft and checked my Console to find several notations like this:

    28/01/16 22:52:10 firefox [14441] Set intl.ime.nstextinput.enable to true in topic: config to the difficulty of entry.

    28/01/16 22:58:10 [0 x 0-0x3d43d4].org.mozilla.firefox [14441] 1454050690890 addons.update - checker clearly WARN of update for {972ce4c6-7e08-4474-a285-3208198ce6fd} did not contain a property of updates

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x1003d8980 NSCFDictionary autoreleased with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x1003dc160 NSCFArray autoreleased with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x1003bd6c0 NSCFDictionary autoreleased with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x11accb6f0 NSCFData autoreleased with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): 0x11c2a9940 of class __NSFastEnumerationEnumerator autoreleased object with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x11c2dcfc0 NSCFNumber autoreleased with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x118cba2b0 NSConcreteValue autoreleased with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x11ac785e0 NSCFNumber autoreleased with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x118cba310 NSConcreteValue autoreleased with no pool in place - just a leak

    29/01/16 03:36:46 firefox [14834] * __NSAutoreleaseNoPool(): object of class 0x11c2931c0 NSCFDictionary autoreleased with no pool in place - just a leak

    29/01/16 03:36:47 firefox [14834] * __NSAutoreleaseNoPool(): 0 x NSCFNumber autoreleased object of class 100373880 with no pool in place - just a leak

    29/01/16 03:43:21 [0 x 0-0x3e93e9].org.mozilla.firefox [14834] vector smash protection is enabled.

    29/01/16 03:44:44 [0 x 0-0x3e93e9].org.mozilla.firefox [14834] Performance alert: Async off animation because (1325, 9183) image size is larger than the viewport (1508, 801) or the visual (1325, 9183) rectangle is larger than the maximum allowed (17895698) [div]

    29/01/16 03:44:50 [0 x 0-0x3e93e9].org.mozilla.firefox [14834] 0

    29/01/16 03:59:53 [14859] Bulletin Board Bulletin Board: launched from NoticeboardUpdateOperation

    29/01/16 03:59:54 [14859] scoreboard scoreboard: NoticeboardUpdateOperation finished with a request for an opinion to show: (null)

    29/01/16 03:59:54 [14859] Bulletin Board display: no notification to show. Closing.

    29/01/16 04:22:33 Silverlight preferences [14894] could not connect to the SetGPUVideoDecodeEnabled action: the target of the PrefsPaneController class

    29/01/16 04:23:21 [0 x 0-0x3e93e9].org.mozilla.firefox [14834] 0

    29/01/16 04:23:55 firefox [14834] Set intl.ime.nstextinput.enable to true in topic: config to the difficulty of entry.

    29/01/16 04:36:23 firefox [14834] Set intl.ime.nstextinput.enable to true in topic: config to the difficulty of entry.

    Could be my problem?

    Hi, Goldenbill.

    Please visit Apple support communities.

    I understand that your computer stops responding when waking from sleep.  Be sure to quit all open applications that are not in use before placing your iMac in mode 'sleep'.  The article below describes how to leave applications for Yosemite, but the measures also apply to the 10.6.8.

    OS X Yosemite: Quit apps

    The next step would be to go through the following troubleshooting information.

    If your Mac does not wake up when you plan

    Your Mac can to pause a few seconds before he wakes up. If she does not wake up at all, check these possibilities:

    • The brightness of your screen may be refused.
    • If you use an external monitor, your screen can be disabled.
    • Your Mac may be safe sleep. For to wake up the safe sleep, press the power button.
    • Find a light sleep, if any, and make sure that your Mac is not turned off.

    If the previous steps do not work

    These additional steps can help identify or resolve the problem:

    • Reset the SMC.
    • Reset the NVRAM.
    • Disconnect external devices other than your Apple keyboard, mouse, and screen. If that solves the problem, gradually reconnect your devices, testing each time until you find the device that interferes with sleep. And then check the documentation that came with the device or contact the manufacturer of the device.
    • Start in Safe Mode to see if the problem is related to startup items not Apple, login items or kernel extensions.
    • Try to isolate the problem by using a different user account.

    If your Mac does not sleep or wake up when expected

    See you soon

  • Repeated restarts when waking from sleep

    I have a MacBook Pro OS 10.10.5. The computer was started by browsing sometimes restart several cycles when waking from sleep. When this happens, I don't me the login screen. I held down the power button to turn off the computer, and then restart. About 6 weeks, the original internal hard drive has failed and was replaced by a SSD drive. But the problem didn't start until a few days ago. There were no other change in hardware or software. The computer is connected to an external monitor and external power is all the time, except when I travel or deliberately to drain the battery for maintenance. I checked the various discussions, but could not find any solution accepted to this problem.

    Start - computer restarts by itself-Yosemite

  • Apple tv closes when streaming from my ipad

    Apple tv closes when streaming from my ipad

    It is impossible to repair without unplugging everything.

    Can you elaborate?

Maybe you are looking for

  • Tecra 750: Question on the infrared remote control and TV

    Hello I wonder if anyone can help. I have an old Tecra 750 which I use as a sound system to play my MP3 collection. It has an infrared detector on it and I was wondering if it is possible to use this to receive a TV remote control IR, so I can use a

  • Lenovo laptop z500 does not

    Hello I started having a problem with my computer laptop z500 and here's how it went past. First I updated my laptop to Windows 8 to 8.1, and then after the update has been finalizied that I closed my laptop, then the next day I woke up and tried to

  • Recovery management

    Nice day. I have a problem, I can't go back in the departments of the factory. Recovery Manager does not see the recovery partition. HP G72 Notebook PC computer. Thank you.

  • Application wide error division by 0 installation police quest game

    Hello My OS is Vista.I am trying to install an older game (Police Quest) and the listed top application error is displayed during installation. It will be Don't let me install the game. I'm doing something wrong? Thanks for any help.

  • kp2572073 installs again and again

    KB2572073 installed on my XP machine fine... then KB2572073 install on my XP machine fine... then KB2572073 installed on my XP machine fine, etc., etc. I even installed it manually only find wants to install again with the automatic update! I checked