Results 1 to 3 of 3

Thread: Image 32 bit depth to 8 bit depth

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Image 32 bit depth to 8 bit depth

    Hi,

    I'm taking an image from scanner using TWAIN and I use the "QPixmap::fromWinHBITMAP(HBITMAP)" method to convert the scanned image to a QPixmap. The HBITMAP info tells me that the image is 8 bit depth but when converting to QPixmap it returns me 32 bit depth.

    Any one knows how to convert this QPixmap 32 bit depth to 8 bit depth? The image is scanned on 8 bit depth gray.
    Thanks,
    Last edited by ^NyAw^; 1st September 2008 at 10:42.
    Òscar Llarch i Galán

  2. #2
    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: Image 32 bit depth to 8 bit depth

    Convert it to image using QPixmap::toImage() and then use QImage::convertToFormat() to convert it to QImage::Format_Indexed8. Then you might need to adjust the palette.

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Image 32 bit depth to 8 bit depth

    Thanks,

    I have used another way. I created the image with Width and Height and Indexed palette, then I just copied the image buffer to the QImage buffer. Now I only just have to invert the copy process because the Bitmaps are stored inverted by line.

    Thanks,
    Òscar Llarch i Galán

Similar Threads

  1. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  2. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  3. Explanation to Image Formats
    By sincnarf in forum Qt Programming
    Replies: 13
    Last Post: 6th July 2007, 17:02
  4. Help needed handling image data
    By toratora in forum General Programming
    Replies: 2
    Last Post: 11th May 2007, 09:24
  5. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36

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.