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

  • 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:
    and this png transparent image:

    what i want is this:

    maybe qpaint/qimage..?

  • Moderators

    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.

  • 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)

  • Moderators

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

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

    QPixmap newImage(...);
    QPainter painter(&newImage);


  • 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 :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.