Results 1 to 3 of 3

Thread: Greyscale png with transparency

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2011
    Posts
    14
    Thanks
    1

    Default Greyscale png with transparency

    I have an image I create that is normalized to 8-bit (0->255) stored as quint8*. I pass this to QImage and it works well. Is there anyway to set the black pixels to transparent without using libpng to set the tRNS?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Greyscale png with transparency

    Convert the QImage to one of the formats which support alpha channel (example QImage::Format_ARGB32) , then set the black color pixels with alpha color.

    Read about
    QImage::convertToFormat();
    QImage:: pixelColor();
    QImage::setPixelColor();
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. 8bit greyscale raw picture find painted area
    By dazedly in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2012, 09:00
  2. Save greyscale image
    By Lele in forum Qt Programming
    Replies: 8
    Last Post: 12th August 2008, 08:59
  3. QImage-Greyscale-8-bits-pixel
    By Ivan Labrador in forum Newbie
    Replies: 5
    Last Post: 3rd August 2008, 00:08
  4. Painter greyscale, image quality paint-brush!
    By patrik08 in forum Qt Programming
    Replies: 4
    Last Post: 22nd March 2007, 20:32
  5. transparency
    By roms18 in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2006, 19:38

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.