Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Question about editing an image with a qt fuction

[Solved] Question about editing an image with a qt fuction

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 4.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    So let's say we have a normal image, and a transparent png image.. both in same resolution eg. 1024x768
    Is there a qt fuction that can stick this images together ( the jpg as a background and the png in front ) and then save it as an image..

    for example i have this normal image:
    !http://i.imgur.com/WaVtJ.png(1)!
    and this png transparent image:
    !http://i.imgur.com/sLXj6.png(2)!

    what i want is this:
    !http://i.imgur.com/nr6N2.png(3)!

    maybe qpaint/qimage..?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on last edited by
      #2

      QPainter can paint an image or pixmap onto to any paint device. Create a new image, and use a QPainter to draw your background image, then overlay your top image.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leon
        wrote on last edited by
        #3

        no i don't want to draw anything..
        i have 2 ready images in my disk.. something like:

        blabla->setbackround(image1 location here)
        blabla->addimageinfront(image 2 location here)
        blabla->saveimage(a path here)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

          You can use QPainter to "stamp down" an existing image onto a pixmap.

          Quick Pseudocode:
          @
          QPixmap background("...");
          QPixmap foreground("...");

          QPixmap newImage(...);
          QPainter painter(&newImage);
          painter.drawPixmap(background);
          painter.drawPixmap(foreground);

          newImage.save();
          @

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Leon
            wrote on last edited by
            #5

            you just caught me before posting it.. founded it here (http://stackoverflow.com/questions/4755970/nokia-qt-edit-image)..

            same as yours.. thanks .. the .save works for me :)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved