[webkit-qt] QImage/QPixmaps and flash transparency

James Wu jwu at eyereturn.com
Mon Jan 30 11:50:49 PST 2012


Hi,

I'm writing an application to take a screenshots of a webpage and am using
webkitqt with python bindings.
It works well except for when there is transparent flash. The transparency
doesn't show. (ie: http://www.flashdesignerzone.com/help/transparent.htm)
I'm running on Debian Wheezy and have 4:4.7.3.-5 installed and am using
python bindings (python-qt4 4.9-2).

At first, I thought it was a flash transparency issue but I am able to use
imagemagick's "import" tool to take a screenshot of the X screen. ( For
example, when I run: DISPLAY=:1 import -window root test.jpg ) In that
case, the flash transparency works so what it seems like to me a
QImage/QPixmap issue.
Any thoughts or ideas on what I should do? I've been browsing the class
references and don't see anything that sticks out to me that I should try.

James



Here's some skeleton code:

import subprocess
import sys
import time
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

def takeScreen():
webpage.setViewportSize(webpage.mainFrame().contentsSize())
image = QImage(webpage.viewportSize(), QImage.Format_ARGB32_Premultiplied)
 painter = QPainter(image)
webpage.mainFrame().render(painter)
painter.end()
 image.save("test2.jpeg", "JPG", quality=50)
screen_cmd = [ "DISPLAY=:1 /usr/bin/import -window root
/opt/eyeverify/screenshots_debug/test.jpeg"]
 xvfb_screen = subprocess.Popen(screen_cmd, shell=True)
        sys.exit()

app = QApplication(sys.argv)

web = QWebView()
webpage = QWebPage()
web.setPage(webpage)

webpage.connect(webpage, SIGNAL("loadFinished(bool)"), takeScreen)

settings = webpage.settings()
settings.PluginsEnabled = True
settings.setAttribute(QWebSettings.PluginsEnabled,True)

web.setGeometry(0,0,1024,200)
web.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)

webpage.mainFrame().load(QUrl("
http://www.flashdesignerzone.com/help/transparent.htm"))
web.show()

sys.exit(app.exec_())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20120130/a59294b7/attachment.html>


More information about the webkit-qt mailing list