图像lib& Qt4的 [英] image lib & Qt4

查看:47
本文介绍了图像lib& Qt4的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找支持常见图像类型的图片库(可能是
freeimagepy?)并且相对容易显示通过

加载的图片来自PyQt4中的lib 。

任何想法?


Aljosa

i''m looking for image lib which supports common image types (maybe
freeimagepy?) and is relatively easy to display image loaded through
that lib in PyQt4.
any ideas?

Aljosa

推荐答案

aljosa写道:
aljosa wrote:
我正在寻找支持常见图像类型的图像库(也许是免费图像?)并且相对容易显示通过
加载的图像PyQt4中的lib。
任何想法?
i''m looking for image lib which supports common image types (maybe
freeimagepy?) and is relatively easy to display image loaded through
that lib in PyQt4.
any ideas?




使用PIL& StringIO用于创建图像的内存中表示,例如

PNG。使用Qt加载。


Diez



Use PIL & StringIO to create a in-memory representation of the image as e.g.
PNG. Load that using Qt.

Diez


是否有人知道如何加载< StringIO.StringIO实例> (来自Qt(v.4.1.3)的内存

表示PNG图像)作为QImage?


Diez B. Roggisch写道:
does anybody know how to load <StringIO.StringIO instance> (in-memory
representation of PNG image) from Qt (v.4.1.3) as QImage?

Diez B. Roggisch wrote:
aljosa写道:
aljosa wrote:
我正在寻找支持常见图像类型的图像库(也许是
freeimagepy?)并且相对容易显示图像加载通过
在PyQt4中的lib。
任何想法?
i''m looking for image lib which supports common image types (maybe
freeimagepy?) and is relatively easy to display image loaded through
that lib in PyQt4.
any ideas?



使用PIL& StringIO用于创建图像的内存中表示,例如
PNG。使用Qt加载。

Diez



Use PIL & StringIO to create a in-memory representation of the image as e.g.
PNG. Load that using Qt.

Diez






aljosa写道:
aljosa wrote:
是否有人知道如何加载< StringIO.StringIO实例> (来自Qt(v.4.1.3)的内存
PNG图像表示)作为QImage?
does anybody know how to load <StringIO.StringIO instance> (in-memory
representation of PNG image) from Qt (v.4.1.3) as QImage?




如果你想要来自StringIO对象的数据,你可以*从对象中读取*

数据(毕竟它是一个类似文件的对象),或者使用

getvalue()方法。


类似


qim = QImage()

qim.loadFromData(f.getvalue())< br $> b $ b应该有效(除非他们最近改变了一些东西)。


为了获得更好的性能,你应该可以使用PIL' 'sostring()

方法以及QImage构造函数的QImage(缓冲区,宽度,高度,深度,


< / F>



If you want the data from a StringIO object, you can either *read* the
data from the object (it''s a file-like object, after all), or use the
getvalue() method.

Something like

qim = QImage()
qim.loadFromData(f.getvalue())

should work (unless they''ve changed things around lately).

To get better performance, you should be able to use PIL''s tostring()
method together with the QImage(buffer, width, height, depth,
colortable, numColors, bitOrder) form of the QImage constructor.

</F>


这篇关于图像lib&amp; Qt4的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆