Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Display BMP image from raw bitmap file
QtWS25 Last Chance

Display BMP image from raw bitmap file

Scheduled Pinned Locked Moved Mobile and Embedded
am335xqt4.8raw imagesbitmapqlabelpixmap
6 Posts 2 Posters 6.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vk41286
    wrote on 6 Jul 2015, 17:42 last edited by vk41286 7 Jun 2015, 17:42
    #1

    I am using Ti AM335x Board.

    I am trying to create a QT application which will display a image (bmp) from a raw bitmap file. The raw bitmap file is of .panel file format. Its in RGB565 format.

    How do we use/convert the raw bitmap (img.panel) into a bmp file, so I can use it Qimage.

    Here is my sample Code :

    QFile file("/usr/bitmap.bmp");
    if (!file.open(QFile::ReadOnly))
    return 0;

    QByteArray array = file.readAll();
    QImage image((const uchar*)array.data(), h_bitmap, v_bitmap, QImage::Format_RGB16);
    image.save("/usr/test_qimg_16.bmp","BMP");
    image = image.convertToFormat(QImage::Format_RGB16);
    image.load("/usr/test_qimg_16.bmp");
    QLabel myLabel;
    myLabel.setPixmap(QPixmap::fromImage(myImage));
    myLabel.show();

    Here I am able to get the bmp image on label. But the image is distorted a lot. Its not as original image.

    Could any one help on this regard.
    Thank you

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Jul 2015, 23:02 last edited by
      #2

      Hi and welcome to devnet,

      What happens if you just open the file in a QImage before setting it on the QLabel ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vk41286
        wrote on 7 Jul 2015, 05:28 last edited by
        #3

        The image itself is distorted before sending it to Qlabel.

        Here is the image I get after i run the above code. The display is 160 X 128 LCD. No touch screen and No mouse.
        http://tinypic.com/r/kb4pd4/8

        Original image should be like this.
        http://tinypic.com/r/dptpq1/8

        Any help is appreciated.

        Thank you

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 11 Jul 2015, 21:29 last edited by
          #4

          Is your LCD working in RGB888 ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          V 1 Reply Last reply 13 Jul 2015, 04:23
          0
          • S SGaist
            11 Jul 2015, 21:29

            Is your LCD working in RGB888 ?

            V Offline
            V Offline
            vk41286
            wrote on 13 Jul 2015, 04:23 last edited by vk41286
            #5

            @SGaist

            No.
            The LCD works on RGB565 (16bit). Its dimension is 160x128.

            This is the .panel file i.e. is the raw file.

            s000.tinyupload.com/?file_id=02804374183229949724.
            I am trying to read this file and doing above operation.

            This is the original image file
            s000.tinyupload.com/?file_id=37294795439804064119 Thanks for helping.

            How do I get a .panel file ?

            I download a jpeg file width 160x128.
            Then use a package called "netpbm" to convert it to .ppm format.

            Use the package "ppmtopanel" (which is a proprietary package) to convet the .ppm file to .panel file. Now this .panel file is raw file. Its not a bitmap file. But it contains some image.

            Thank you for helping.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 13 Jul 2015, 20:33 last edited by
              #6

              Do you have Qt configured to use that display ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              1/6

              6 Jul 2015, 17:42

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved