Results 1 to 6 of 6

Thread: How to read and display BMP image just using QT's GUI?

  1. #1
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default How to read and display BMP image just using QT's GUI?

    http://www.kalytta.com/bitmap.h

    I'm catching on the course of image processing.So I want to use the above bitmap file loader to read the bitmap without using QImage or any other bulit in qt classes. Then display the bitmap in the qt gui. Any advices?

    Thanx a lot in advance.

  2. #2
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to read and display BMP image just using QT's GUI?

    Hi!

    I can't quite see the point! Do you want to draw the bitmap data yourself or use a qt class for that?

    If the later you could have a look at the qimage constructors that take a pointer to raw data. I leave it to you to guess what function of your bitmap library you need to call to get to the data :->

    Joh

  3. The following user says thank you to JohannesMunk for this useful post:

    everlasting525 (3rd April 2011)

  4. #3
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to read and display BMP image just using QT's GUI?

    Hi, Joh

    I want to read and draw the bitmap myself. Later I will also implement more functions learned form the course of image processing myself.
    For now how to draw the image after using my bitmap library is my main problem.

    ever

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to read and display BMP image just using QT's GUI?

    I also don't see the point, you'll be doing twice as much work as needed. If you want to do the reading yourself then afterwards you have to fill a QImage object with properly formatted data that is probably completely different than the one you have after reading the file. So first you'll be converting data from the file to your own format and then from your own format to what QImage expects. If you don't care about efficiency you can use QImage::setPixel() after you initialize QImage with a proper size and color map. If you do care about efficiency, use QImage::bits() and fill the returned pointer with pixel data in a format chosen earlier for QImage.

    But if you want to read and draw the bitmap yourself, what do you need QImage for?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    everlasting525 (3rd April 2011)

  7. #5
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to read and display BMP image just using QT's GUI?

    Hi!

    I would recommend to leave the drawing of the image to QImage/QPixmap/QLabel and concentrate on the implementation of the image processing.

    If you need further (wysota gave you some good hints) help to get your image data displayed in such a way, just let us know.

    Drawing the image yourself pixel by pixel e.g. in the paintEvent of some custom widget is utterly slow and will not teach you much if anything worthwhile - if that's what you had in mind.

    Good luck with your studies,

    Joh

  8. The following user says thank you to JohannesMunk for this useful post:

    everlasting525 (3rd April 2011)

  9. #6
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to read and display BMP image just using QT's GUI?

    Thanks for replying. Maybe I should focus on the part of image processing. Not the loading itself.

    THANX for your recommendation. I know what i am going to do now.

Similar Threads

  1. Replies: 4
    Last Post: 17th September 2010, 20:18
  2. Replies: 3
    Last Post: 17th March 2010, 10:31
  3. how to read in image date from memory zone
    By elflord in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2009, 19:44
  4. How to read rtf file and display it?
    By sunnysun520 in forum Qt Programming
    Replies: 2
    Last Post: 16th May 2009, 14:48
  5. How to Read and display BMP image using QT
    By agsrinivasan in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2007, 07:14

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.