标签: python-imaging-library

PyPI上没有Python Imaging Library,或者我错过了什么?

easy_install pil 导致错误:

Searching for pil
Reading http://pypi.python.org/simple/pil/
Reading http://www.pythonware.com/products/pil
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
No local packages or download links found for pil
error: Could not find suitable distribution for Requirement.parse(‘pil’)
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

-

更新: 嗯,要求它在Python Ware网站上查找链接似乎正在工作:

easy_install -f http://www.pythonware.com/products/pil/ Imaging

虽然有一堆警告.我会看到结果如何.

-

更新:我可以使用Python导入它import Image,但是当我告诉Django syncdb时,我仍然会收到以下错误:

Error: One or more models did not validate:
core.userprofile: “avatar”: To use ImageFields, you need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/ .
Run Code Online (Sandbox Code Playgroud)

我在我的一个模型中使用了ImageField.

python django python-imaging-library

1
推荐指数
1
解决办法
4969
查看次数

PIL 中缺少 ImageOps 模块?

我正在尝试在 Django 中保存图像并收到错误“无法导入 ImageOps 模块”

出于某种原因,我无法在 django shell 中从 PIL 导入或使用 ImageOps 模块。我曾尝试删除鸡蛋并重新安装 PIL,但这不起作用。我查看了鸡蛋的内部,ImageOps.py 在那里,当我进入它时,一切看起来都很好。

有谁知道为什么我会失去对单个模块的访问权限?

python django python-imaging-library

1
推荐指数
1
解决办法
5428
查看次数

在PIL python中查询im.save

im.load()用来获取ORIGINAL_IMAGE的像素.随后,我保存了它

我看到保存的东西与我想要保存的不同 -

这是一个代码片段和输出,将突出我的问题 -

片段:

im = Image.open(ORIGINAL_IMAGE)
dup_im = im.copy()
pix = dup_im.load() 
dup_im.save(DUP_IMAGE)
saved_im = Image.open(DUP_IMAGE)
saved_pix = saved_im.load()

for i in range(10):
        print  pix[0, i], " : ", saved_pix[0, i]
Run Code Online (Sandbox Code Playgroud)

印刷品的输出 -

在节约之前:节约之后

$ python test.py 
162  :  162
162  :  162
162  :  163
162  :  163
162  :  163
164  :  162
160  :  161
159  :  160
155  :  153
155  :  155
$ 
Run Code Online (Sandbox Code Playgroud)

我的Python版本的详细信息 -

$ python
Python 2.6.1 (r261:67515, …
Run Code Online (Sandbox Code Playgroud)

python image image-processing python-imaging-library

1
推荐指数
1
解决办法
728
查看次数

使用Python裁剪AVI文件

我有一个媒体文件(AVI或mpeg并不重要)我想得到每个帧的上半部分并从我的视频中删除下半部分.在python中有任何库可以帮助我吗?

python pygame python-imaging-library

1
推荐指数
1
解决办法
680
查看次数

皮尔?提取给定 RGB 值的所有像素

给定一个图像(.tiff 或 geotiff 文件)正好有 22 种颜色(每种颜色都有一个不同的 RGB 值),有什么方法可以将它们分离(“过滤”)成 22 个单独的图像,每个图像只包含那些具有特定 RGB 的像素价值?

gdal python-imaging-library

1
推荐指数
1
解决办法
2903
查看次数

因为 PIL 需要一个文件对象,所以我试图使用 tempfile 创建一个文件。遇到我认为的缓冲区问题

我正在尝试从我的数据库中的条目创建一个临时文件。我做了一个print(filedata['data']),我可以看到数据正在被正确检索,但即使temp_h.flush()我从未看到任何数据保存到文件中。当我去检索它时,文件是空的。有人可以向我解释是什么导致了这种情况,如果有更好的方法来做我正在尝试用 PIL 做的事情,我也很想学习。我在带有 EXT3 文件系统的 Linux 系统上运行它

def main():
    '''Main'''

    for nohisto in thestash.stash.get_files():
       fileid = str(nohisto['_id'])
       filedata = openstash(fileid)
       temp_h = tempfile.TemporaryFile(mode='r+')
       temp_h.write(filedata['data'])
       temp_h.flush()
       time.sleep(3)
       myhisto = Image.open(temp_h).histogram()
Run Code Online (Sandbox Code Playgroud)

python file-io file python-imaging-library

1
推荐指数
1
解决办法
956
查看次数

从第一原理简单地"模糊"表示python中的图像的数组

我有一个图像,包括两个任意放置的黑色1px"斑点"在白色画布上100px到200px.我试图通过将一些相邻像素(每个blob的半径10px内)转为黑色来模糊这些斑点.我已经将以下代码放在一起,但我不确定下一步...

import numpy as np
from PIL import Image 
from scipy import ndimage
from matplotlib import pyplot
from matplotlib import cm
from scipy.misc import imsave

im = Image.open("test.png")
pix = np.asarray(im)
new_pix = np.copy(pix[:,:,0]) # need this otherwise can't write to the pix array.
pix_to_enlarge = np.where(new_pix != 255)
pixels_to_enlarge_by = 10
i=0
for each_pixel in pix_to_enlarge[0]: # this cycles through each non-white pixel
    for y in range(len(new_pix)): # this looks across the length (down) the page
        for x in …
Run Code Online (Sandbox Code Playgroud)

python numpy image-processing python-imaging-library python-2.7

1
推荐指数
1
解决办法
2912
查看次数

使用 Python PIL 库将图像垂直淡化为透明

我查看了教程、其他 stackoverflow 问题和 PIL 文档本身,但我仍然不确定如何去做。

我想开始在 y 轴下方大约 55% 处垂直淡化图像,并使图像在大约 75% 处完全透明。保留图像的完整高度很重要,即使最后 25% 左右应该是完全透明的。

这可能与PIL有关吗?

python png transparency python-imaging-library

1
推荐指数
1
解决办法
3146
查看次数

在Python中将RGBA转换为RGB

使用PIL将RGBA图像转换为RGB的最简单,最快的方法是什么?我只需要从某些图像中删除A通道即可。

我找不到一个简单的方法来执行此操作,我不需要考虑背景。

rgb image type-conversion python-imaging-library python-3.x

1
推荐指数
2
解决办法
6176
查看次数

在Python中计算特定值图像的每个像素的有效方法?

我有一个由7种不同颜色组成的RGB图像.我想以有效的方式计算图像中存在的每种像素类型的数量.因此,如果可能的话,不要在每个像素上进行循环,至少不要手动(numpy操作可以,因为它的速度更快)

我尝试将它加载到一个numpy数组中,它给了我一个N*M*3数组,但我无法想出一种计算特定值的像素的方法......任何想法?

谢谢 !

python opencv numpy python-imaging-library

1
推荐指数
1
解决办法
1223
查看次数