Results 1 to 20 of 21

Thread: QImage Rotation and Translation & Invert Specific Colors

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #18
    Join Date
    Jun 2013
    Posts
    46
    Thanks
    24
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: QImage Rotation and Translation & Invert Specific Colors

    Not sure what an indexed image is...
    But the images that i will be loading will be grayscale images
    & will have ext: .png *.xpm *.jpg *.bmp *.tif

    I tried loading
    Image is not uploaded

    Maybe the image is being uploaded but the entire image is converted to the color gray!
    hence it looks like no image is uploaded


    I added
    Qt Code:
    1. image1.convertToFormat(QImage::Format_Mono); // if not grayscale converting to grayscale
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. QVector<QRgb> colorTable = image1.colorTable();
    2. for(int i=0;i<colorTable.size();++i)
    3. {
    4. colorTable[i] = qRed(qGray(colorTable[i]));
    5. }
    6. image1.setColorTable(colorTable);
    To copy to clipboard, switch view to plain text mode 

    got rid of the iff statement

    Last edited by 2lights; 14th August 2013 at 16:01. Reason: updated contents

Similar Threads

  1. Replies: 0
    Last Post: 23rd July 2013, 13:19
  2. Graph rotation
    By jomarin in forum Qwt
    Replies: 2
    Last Post: 16th August 2010, 09:21
  3. Ellipse and rotation
    By navi1084 in forum Qt Programming
    Replies: 3
    Last Post: 9th March 2009, 10:43
  4. Rotation on Qframe
    By Pharell in forum Qt Programming
    Replies: 11
    Last Post: 2nd April 2008, 16:31
  5. Replies: 3
    Last Post: 15th March 2006, 11:44

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
  •  
Qt is a trademark of The Qt Company.