當前位置: 首頁>>代碼示例>>Python>>正文


Python ImageQt.ImageQt方法代碼示例

本文整理匯總了Python中PIL.ImageQt.ImageQt方法的典型用法代碼示例。如果您正苦於以下問題:Python ImageQt.ImageQt方法的具體用法?Python ImageQt.ImageQt怎麽用?Python ImageQt.ImageQt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PIL.ImageQt的用法示例。


在下文中一共展示了ImageQt.ImageQt方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: load_map

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def load_map(self, lat0=42, lat1=-1, lon0=55, lon1=3, zoom=3):
        """
        Load a map image into the widget
        :param lat0:
        :param lat1:
        :param lon0:
        :param lon1:
        :param zoom: 1~14
        """
        # store coordinates
        self.lat0 = lat0
        self.lat1 = lat1
        self.lon0 = lon0
        self.lon1 = lon1
        self.zoom = zoom

        # get map
        map = smopy.Map((lat0, lat1, lon0, lon1), z=zoom)

        w, h = map.img.size
        self.img = ImageQt(map.img)
        self.image = QPixmap.fromImage(self.img)

        # resize widget
        self.setRect(0.0, 0.0, w, h) 
開發者ID:SanPen,項目名稱:GridCal,代碼行數:27,代碼來源:show_map_tests.py

示例2: setUp

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def setUp(self):
        PillowQtTestCase.setUp(self)
        try:
            if ImageQt.qt_version == '5':
                from PyQt5.QtGui import QGuiApplication
            elif ImageQt.qt_version == '4':
                from PyQt4.QtGui import QGuiApplication
            elif ImageQt.qt_version == 'side':
                from PySide.QtGui import QGuiApplication
            elif ImageQt.qt_version == 'side2':
                from PySide2.QtGui import QGuiApplication
        except ImportError:
            self.skipTest('QGuiApplication not installed')

        self.app = QGuiApplication([]) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:17,代碼來源:test_imageqt.py

示例3: test_sanity

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def test_sanity(self):
        for mode in ('RGB', 'RGBA', 'L', 'P', '1'):
            src = hopper(mode)
            data = ImageQt.toqimage(src)

            self.assertIsInstance(data, QImage)
            self.assertFalse(data.isNull())

            # reload directly from the qimage
            rt = ImageQt.fromqimage(data)
            if mode in ('L', 'P', '1'):
                self.assert_image_equal(rt, src.convert('RGB'))
            else:
                self.assert_image_equal(rt, src)

            if mode == '1':
                # BW appears to not save correctly on QT4 and QT5
                # kicks out errors on console:
                #     libpng warning: Invalid color type/bit depth combination
                #                     in IHDR
                #     libpng error: Invalid IHDR data
                continue

            # Test saving the file
            tempfile = self.tempfile('temp_{}.png'.format(mode))
            data.save(tempfile)

            # Check that it actually worked.
            reloaded = Image.open(tempfile)
            # Gray images appear to come back in palette mode.
            # They're roughly equivalent
            if QT_VERSION == 4 and mode == 'L':
                src = src.convert('P')
            self.assert_image_equal(reloaded, src) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:36,代碼來源:test_qt_image_toqimage.py

示例4: __init__

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def __init__(self):
            super(Example, self).__init__()

            img = hopper().resize((1000, 1000))

            qimage = ImageQt.ImageQt(img)

            pixmap1 = QtGui.QPixmap.fromImage(qimage)

            QHBoxLayout(self)  # hbox

            lbl = QLabel(self)
            # Segfault in the problem
            lbl.setPixmap(pixmap1.copy()) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:16,代碼來源:test_qt_image_toqimage.py

示例5: test_rgb

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def test_rgb(self):
        # from https://doc.qt.io/archives/qt-4.8/qcolor.html
        # typedef QRgb
        # An ARGB quadruplet on the format #AARRGGBB,
        # equivalent to an unsigned int.
        if ImageQt.qt_version == '5':
            from PyQt5.QtGui import qRgb
        elif ImageQt.qt_version == '4':
            from PyQt4.QtGui import qRgb
        elif ImageQt.qt_version == 'side':
            from PySide.QtGui import qRgb
        elif ImageQt.qt_version == 'side2':
            from PySide2.QtGui import qRgb

        self.assertEqual(qRgb(0, 0, 0), qRgba(0, 0, 0, 255))

        def checkrgb(r, g, b):
            val = ImageQt.rgb(r, g, b)
            val = val % 2**24  # drop the alpha
            self.assertEqual(val >> 16, r)
            self.assertEqual(((val >> 8) % 2**8), g)
            self.assertEqual(val % 2**8, b)

        checkrgb(0, 0, 0)
        checkrgb(255, 0, 0)
        checkrgb(0, 255, 0)
        checkrgb(0, 0, 255) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:29,代碼來源:test_imageqt.py

示例6: test_image

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def test_image(self):
        for mode in ('1', 'RGB', 'RGBA', 'L', 'P'):
            ImageQt.ImageQt(hopper(mode)) 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:5,代碼來源:test_imageqt.py

示例7: paintEvent

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def paintEvent(self, event):
        imageqt = ImageQt.ImageQt(self.display_image)
        p = QtGui.QPainter()
        p.begin(self)
        p.setRenderHint(QtGui.QPainter.Antialiasing, True);
        scale = self.height() / float(imageqt.height() + 10)
        p.scale(scale, scale)
        p.translate((self.width() / 2 / scale - imageqt.width()  / 2),
                    (self.height() / 2 / scale - imageqt.height() / 2))
        p.fillRect(0, 0, imageqt.width(), imageqt.height(), QtGui.QColor(0, 0, 0))
        p.drawImage(0, 0, imageqt)
        NODE_RADIUS = 4
        # draw nodes
        for loop in self.snake.loops:
            for i in range(len(loop.nodes)):
                p.setPen(QtGui.QColor(255, 0, 0))
                p.setBrush(QtGui.QBrush(QtGui.QColor(255, 0, 0)))
                p.drawEllipse(loop.nodes[i][1] - NODE_RADIUS / 2.0,
                        loop.nodes[i][0] - NODE_RADIUS / 2.0, NODE_RADIUS, NODE_RADIUS)
        # draw lines between nodes
        for loop in self.snake.loops:
            for i in range(len(loop.nodes)):
                if len(loop.nodes) > 1:
                    n = i+1
                    if n == len(loop.nodes):
                        n = 0
                    p.setPen(QtGui.QColor(0, 255, 0))
                    p.drawLine(loop.nodes[i][1], loop.nodes[i][0], loop.nodes[n][1], loop.nodes[n][0])
        p.end() 
開發者ID:nasa,項目名稱:CrisisMappingToolkit,代碼行數:31,代碼來源:test_active_contour.py

示例8: updateCountdown

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def updateCountdown(self, event):

        picture = Image.open(event.picture)
        self._gui.centralWidget().picture = ImageQt.ImageQt(picture)
        self._gui.centralWidget().update() 
開發者ID:reuterbal,項目名稱:photobooth,代碼行數:7,代碼來源:PyQt5Gui.py

示例9: showReview

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def showReview(self, state):

        picture = Image.open(state.picture)
        self._picture = ImageQt.ImageQt(picture)
        review_time = self._cfg.getInt('Photobooth', 'display_time') * 1000
        self._setWidget(Frames.PictureMessage(self._picture))
        QtCore.QTimer.singleShot(
            review_time,
            lambda: self._comm.send(Workers.MASTER, GuiEvent('postprocess')))
        self._postprocess.do(self._picture) 
開發者ID:reuterbal,項目名稱:photobooth,代碼行數:12,代碼來源:PyQt5Gui.py

示例10: print

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def print(self, picture):

        if self._conn is not None:
            if isinstance(picture, ImageQt.ImageQt):
                picture.save(self._tmp_filename)
            else:
                picture.save(self._tmp_filename, format='JPEG')
            self._conn.printFile(self._printer, self._tmp_filename,
                                 "photobooth", {}) 
開發者ID:reuterbal,項目名稱:photobooth,代碼行數:11,代碼來源:PrinterPyCups.py

示例11: updateLabelToClusterShowImage

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def updateLabelToClusterShowImage(displayLabel, filename, width=240, height=240):
    # Compute cluster memberships
    compactness = int(COMPACTNESS_SETTING_OPTIONS[SELECTED_COMPACTNESS_SETTING_INDEX])
    n = int(CLUSTER_SETTING_OPTIONS[SELECTED_CLUSTER_SETTING_INDEX])
    spectral_roi.spectral_cluster(filename, CLUSTER_IMAGE_FILENAME, compactness, n)

    # Display result
    picture = Image.open(CLUSTER_IMAGE_FILENAME)
    picture.thumbnail((width,height), Image.ANTIALIAS)
    pixmap = QtGui.QPixmap.fromImage(ImageQt(picture))
    displayLabel.setPixmap(pixmap)
    displayLabel.setFixedSize(width, height) 
開發者ID:oduwa,項目名稱:Pic-Numero,代碼行數:14,代碼來源:gui.py

示例12: updateLabelToShowImage

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def updateLabelToShowImage(displayLabel, filename, width=240, height=240):
    picture = Image.open(filename)
    picture.thumbnail((width,height), Image.ANTIALIAS)
    pixmap = QtGui.QPixmap.fromImage(ImageQt(picture))
    displayLabel.setPixmap(pixmap)
    displayLabel.setFixedSize(width, height) 
開發者ID:oduwa,項目名稱:Pic-Numero,代碼行數:8,代碼來源:gui.py

示例13: __init__

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def __init__(self, parent, address):
        super(BitcoinQRCodePopup, self).__init__(parent)
        self.address = address
        self.setWindowTitle(address)
        img = qrcode.make('bitcoin:' + address)
        self.imageLabel = QLabel()
        self.imageLabel.setPixmap(QPixmap.fromImage(ImageQt(img)))
        layout = QVBoxLayout()
        layout.addWidget(self.imageLabel)
        self.setLayout(layout)
        self.initUI() 
開發者ID:JoinMarket-Org,項目名稱:joinmarket-clientserver,代碼行數:13,代碼來源:joinmarket-qt.py

示例14: run

# 需要導入模塊: from PIL import ImageQt [as 別名]
# 或者: from PIL.ImageQt import ImageQt [as 別名]
def run(self):
		global img
		while cam_open == True:
			try:
				img = ImageQt(cam[cam_no].getImage().resize((240, 180)))
				time.sleep(0.01)
				self.trigger.emit()
			except:
				pass

#重新連接 
開發者ID:Jackeriss,項目名稱:Email_My_PC,代碼行數:13,代碼來源:Email My PC.py


注:本文中的PIL.ImageQt.ImageQt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。