The Ultimate Qt Community site
Home News Forum Wiki Contest FAQ Links

Go Back   Qt Centre Forum > Qt > Newbie

Newbie Newbie to Qt? Ask your questions here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 13th May 2008, 02:04
ramstormrage ramstormrage is offline
Novice
 
Join Date: Dec 2007
Qt products used: Qt4
Qt platforms used: Windows
Posts: 32
Thanks: 5
Thanked 0 Times in 0 Posts
Default Displaying Image's Color Table

Hello experts.

Id like to know a way to display an image's color table in a QTableWidget. Let me rephrase the question, if I wanted to display the color table of an image how would I do it?

I would need the output of the color table to find colors that are in a specific range so I can manipulate those color group.

Thank you very much in advance.

Reply With Quote
  #2  
Old 13th May 2008, 06:54
wysota wysota is offline
Guru
 
Join Date: Jan 2006
Location: Warsaw, Poland
Qt products used: Qt3, Qt4
Qt platforms used: Unix/X11, Windows
Posts: 10,483
Thanks: 3
Thanked 1,484 Times in 1,438 Posts
Default Re: Displaying Image's Color Table

If we are speaking about images that do have colour tables (8 bit or less), then use QImage::colorTable() to retrieve it and create table items out of it. If the image is 24b deep, you'll need to iterate the image using QImage::pixel() and build the colour table yourself.

Reply With Quote
  #3  
Old 13th May 2008, 11:34
ramstormrage ramstormrage is offline
Novice
 
Join Date: Dec 2007
Qt products used: Qt4
Qt platforms used: Windows
Posts: 32
Thanks: 5
Thanked 0 Times in 0 Posts
Default Re: Displaying Image's Color Table

Quote:
Originally Posted by wysota View Post
If we are speaking about images that do have colour tables (8 bit or less), then use QImage::colorTable() to retrieve it and create table items out of it. If the image is 24b deep, you'll need to iterate the image using QImage::pixel() and build the colour table yourself.
By saying building the color table myself, that means creating a color table using QImage::setColorTable() and THEN creating table items out of it?

Reply With Quote
  #4  
Old 13th May 2008, 17:07
wysota wysota is offline
Guru
 
Join Date: Jan 2006
Location: Warsaw, Poland
Qt products used: Qt3, Qt4
Qt platforms used: Unix/X11, Windows
Posts: 10,483
Thanks: 3
Thanked 1,484 Times in 1,438 Posts
Default Re: Displaying Image's Color Table

No, it means creating a QList<QColor> and filling it with colours retrieved from the image using QImage::pixel(). 24 bit images don't have colour lookup tables, because the amount of space they would take is bigger than the cost of storing the colour value directly in pixel data. At worst such a lookup table would have 16.7M entries, 3 bytes each + 3 bytes per pixel to store the index of the table in the pixel. It's better to just use 3 bytes per pixel to store the colour directly.

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying different images and data on the same dialog merry Qt Programming 3 17th May 2007 13:50
Displaying real time images Sheetal Qt Programming 9 22nd February 2007 11:29


All times are GMT +1. The time now is 00:41.

Powered by vBulletin Version 3.7.1 Copyright ©2000 - 2008, Jelsoft Enterprises Ltd., vRewrite 1.5 SEOed URLs completed by Tech Help Forum and Chalo Na.
© 2006–2008 Qt Centre - The Ultimate Qt Community site
The Qt by Trolltech logo is used with express permission of Trolltech ASA. Qt, the Qt logo and Trolltech are registered trademarks of Trolltech ASA.