图像lib& Qt4的

编程入门 行业动态 更新时间:2024-10-23 13:30:57
本文介绍了图像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()) 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的

本文发布于:2023-10-09 18:31:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1476448.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   lib   amp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!