Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ QT
Hi
 
I want to get cmyk values of an image in Qt . I have wrote this program but it doesn't work :
 
 
       QImage image=QImage("/home/hor/1.jpg").scaled(ui->spinBox->value(),ui->spinBox_2->value());
        int i=0 ;int j =0;
     
        for(j=0 ; j<image.width();j++)
        { for(i=0;i<image.height();i++)
            {
                QColor color=QColor::fromCmyk(image.pixel(i,j));
     
        ui->plainTextEdit->appendPlainText(QString("cyan is : ") + QString::number(color.cyan())
                                           + QString("magenta is: ") + QString::number(color.magenta())
                                           + QString("yellow is:") + QString::number(color.yellow())
                                           + QString("black is") +QString::number(color.black()));
    }
        }
 
The Error I had get is : no matching function for call to “QColor::fromCmyk(Qrgb);
Posted 4-May-13 18:43pm
hor_313632
Comments
Tadit Dash at 4-May-13 23:49pm
   
Is there a function QColor::fromCmyk(Qrgb); exists in your program ?
If yes, post that code here as well.
hor_313 at 5-May-13 0:03am
   
yes there is
 
I solved it by adding toCmyk() function after this line :
 
QColor color=QColor::fromCmyk(image.pixel(i,j)).toCmyk();
 
and so exchange fromCmk to fromRgb in that line
 
and the program is working , but i am not sure the returns value are true ?!
jsolutions_uk at 24-May-13 4:24am
   
You could always test your values you are getting against this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 575
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,476
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,917


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 4 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100