mirror of https://github.com/vitalif/phantomjs
Issue 20: JPG transparent colour is black.
Filling QImage with transparent white instead of transparent black. For an artifact free rendering of a transparent web page into PNG, Format_ARGB32 is needed instead of Format_ARGB32_Premultiplied.1.1
parent
6fdc9d11f5
commit
494866a769
|
@ -30,7 +30,7 @@ from PyQt4.QtCore import pyqtProperty, pyqtSlot, Qt, QObject, QString, \
|
|||
QRect, SIGNAL, SLOT, QTimer, QUrl, QFileInfo, \
|
||||
QDir, QSize, QSizeF, QTime, QEventLoop, qDebug
|
||||
from PyQt4.QtGui import QPalette, QDesktopServices, qApp, QPrinter, \
|
||||
QImage, QPainter, QRegion, QApplication
|
||||
QImage, QPainter, QRegion, QApplication, qRgba
|
||||
from PyQt4.QtWebKit import QWebSettings, QWebPage
|
||||
from PyQt4.QtNetwork import QNetworkProxy, QNetworkProxyFactory
|
||||
|
||||
|
@ -287,8 +287,8 @@ class Phantom(QObject):
|
|||
if pageSize == '':
|
||||
return False
|
||||
|
||||
image = QImage(bufferSize, QImage.Format_ARGB32_Premultiplied)
|
||||
image.fill(Qt.transparent)
|
||||
image = QImage(bufferSize, QImage.Format_ARGB32)
|
||||
image.fill(qRgba(255, 255, 255, 0))
|
||||
p = QPainter(image)
|
||||
|
||||
p.setRenderHint(QPainter.Antialiasing, True)
|
||||
|
|
Loading…
Reference in New Issue