Results 1 to 14 of 14

Thread: image alpha

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: image alpha

    thank you allot!!
    this is working really good!
    another question:


    if i create a png (4ex in fireworks) with an alpha (4ex 60) and then i close and re-open the image.. the program is able to recognize the fact that the image has an alpha value = 60;
    is it possible to do the same thing with qt ? 'cause now when i re-open the image with the viewer i made it reads the initial alpha value as 255

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: image alpha

    Quote Originally Posted by murko81 View Post
    if i create a png (4ex in fireworks) with an alpha (4ex 60) and then i close and re-open the image.. the program is able to recognize the fact that the image has an alpha value = 60;
    is it possible to do the same thing with qt ? 'cause now when i re-open the image with the viewer i made it reads the initial alpha value as 255
    The image you are showing is created dynamically at run time. You would have to save it back to a file to keep the changes, see QImage::save().
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: image alpha

    Quote Originally Posted by murko81 View Post
    if i create a png (4ex in fireworks) with an alpha (4ex 60) and then i close and re-open the image.. the program is able to recognize the fact that the image has an alpha value = 60;
    is it possible to do the same thing with qt ? 'cause now when i re-open the image with the viewer i made it reads the initial alpha value as 255
    Qt handles alpha just fine. If you feed it with an image which already has an alpha channel, it will display it correctly without the 'hack' we did here.

  4. #4
    Join Date
    Oct 2006
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: image alpha

    of course i save the file before re-opening and of course qt handles fine the alpha channel, maybe i didn't wrote it good (i apologize4my english ).
    The fact is:
    1- I create an image with a commercial editor and i give to that image an alpha value, and i save it: myfolder/myimage.png , and then i close everything.
    2- if i reopen that image with the same commercial editor, it is able to recognize the right alpha value (not only displaying the image in the proper way but also writing it correctly in between the properties of the image)
    3-instead if i reopen the image with my self made editor, i am able to display the image correctly but into the properties the alpha value is recognized as the maximum (255)

    so the question was: how can i read the rigth alpha value? 'cause if a commercial editor is able to do that maybe i can also:-)

    thank you in advance!

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: image alpha

    Quote Originally Posted by murko81 View Post
    3-instead if i reopen the image with my self made editor, i am able to display the image correctly but into the properties the alpha value is recognized as the maximum (255)

    so the question was: how can i read the rigth alpha value?
    And how do you read the alpha value now? This question is really tricky, as alpha is not a single value but a bitmap.

  6. #6
    Join Date
    Oct 2006
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: image alpha

    :-) yes it's not a single value but starting from the fact that in fireworks it shows me it like an unique value i thought that fireworks changes all the alpha values to the same value.. so reading one of them from one single pixel it was enough.. maybe it's not the right way to get it but this is how i did it and this is how i get back always a value = 255;

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: image alpha

    Attached code shows how to do it properly and attached image shows an example result. Image on the left is the actual image whether image on the right is a bitmap of the alpha channel.
    Attached Images Attached Images
    Attached Files Attached Files

Similar Threads

  1. "sensitising" an image
    By TheKedge in forum Qt Programming
    Replies: 2
    Last Post: 28th June 2006, 08:21
  2. Fast image drawing/scaling in Qt 3.3
    By eriwik in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 11:45
  3. problem with the back ground image
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 17th April 2006, 22:34
  4. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 17:36
  5. Question about updating an image on screen
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 24th February 2006, 20:01

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.