标签: pillow

Python图像库失败,消息"解码器JPEG不可用" - PIL

PIL在我的系统中支持JPEG.

每当我上传时,我的代码都失败了:

File "PIL/Image.py", line 375, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

python jpeg python-imaging-library pillow

304
推荐指数
9
解决办法
15万
查看次数

在Linux中安装Pillow(Python模块)时失败

我正在尝试使用pip安装Pillow(Python模块),但它会抛出此错误:

ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting
Run Code Online (Sandbox Code Playgroud)

所以当错误说,我试过:

pip install pillow --global-option="--disable-jpeg"
Run Code Online (Sandbox Code Playgroud)

但它失败了:

error: option --disable-jpeg not recognized
Run Code Online (Sandbox Code Playgroud)

任何提示如何处理它?

python linux pillow

158
推荐指数
8
解决办法
10万
查看次数

如何为Python 3.6安装PIL/Pillow?

我有一个需要PIL运行的脚本.除了降级我的Python,我无论如何都找不到在我的Python 3.6上安装PIL

以下是我的尝试:

pip install pil
Collecting pil
  Could not find a version that satisfies the requirement pil (from versions: )
No matching distribution found for pil

pip install Pillow
Collecting Pillow
  Using cached Pillow-3.3.1.zip
Installing collected packages: Pillow
  Running setup.py install for Pillow ... error
    Complete output from command c:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ABDULR~1\\AppData\\Local\\Temp\\pip-build-rez5zpri\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ABDULR~1\AppData\Local\Temp\pip-a5bugnjo-record\install-record.txt --single-version-externally-managed --compile:
    Single threaded build for windows
    running install
    running build
    running build_py
    creating build
    creating …
Run Code Online (Sandbox Code Playgroud)

python-imaging-library python-3.x pillow

55
推荐指数
2
解决办法
14万
查看次数

在JPG图像上操作时,"无法将模式P写为JPEG"

我正在尝试调整一些图像的大小,其中大部分都是JPG.但在一些图像中,我收到错误:

Traceback (most recent call last):
  File "image_operation_new.py", line 168, in modifyImage
    tempImage.save(finalName);
  File "/Users/kshitiz/.virtualenvs/django_project/lib/python2.7/site-     packages/PIL/Image.py", line 1465, in save
   save_handler(self, fp, filename)
  File "/Users/kshitiz/.virtualenvs/django_project/lib/python2.7/site-   packages/PIL/JpegImagePlugin.py", line 455, in _save
    raise IOError("cannot write mode %s as JPEG" % im.mode)
IOError: cannot write mode P as JPEG
Run Code Online (Sandbox Code Playgroud)

我没有改变图像类型,我正在使用枕头库.我的操作系统是Mac OS X.我该如何解决这个问题?

python macos python-imaging-library pillow

54
推荐指数
3
解决办法
3万
查看次数

在ubuntu 14.04上安装Pillow时出错

我正在尝试使用此命令在Ubuntu 14.04上安装Pillow:

pip install Pillow
Run Code Online (Sandbox Code Playgroud)

但安装失败并出现此错误:

ValueError: --enable-jpeg requested but jpeg not found, aborting.
Run Code Online (Sandbox Code Playgroud)

python pip pillow ubuntu-14.04

49
推荐指数
2
解决办法
3万
查看次数

如何使用PIL/Pillow将图像合并到画布中?

我不熟悉PIL,但我知道将一堆图像放入ImageMagick的网格中非常容易.

例如,我如何将16个图像放入4×4网格中,我可以指定行和列之间的间隙?

python canvas image python-imaging-library pillow

45
推荐指数
2
解决办法
4万
查看次数

在Ubuntu virtualenv上的pip安装枕头出错

我有一个ec2实例,最初在我的virtualenv中安装了Pillow 2.0.不知何故,当我尝试将其升级到Pillow 2.5时,它失败并显示以下消息.即使我在重新安装之前完全移除了Pillow,错误也是一样的.(所以现在我的枕头根本没有Pillow)

$ pip install Pillow
....
....
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -DHAVE_LIBTIFF -I/usr/include/freetype2 -I/home/andycheng/realprice/env/build/pillow/libImaging -I/home/andycheng/realprice/env/include -I/usr/include/tcl8.5 -I/usr/local/include -I/usr/include -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu -c libImaging/RawDecode.c -o build/temp.linux-x86_64-2.7/libImaging/RawDecode.o

gcc: error: unrecognized option ‘-Qunused-arguments’

gcc: error: unrecognized option ‘-Qunused-arguments’

....
....
gcc: error: build/temp.linux-x86_64-2.7/libImaging/XbmEncode.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/ZipDecode.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/ZipEncode.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/TiffDecode.o: No such file or directory …
Run Code Online (Sandbox Code Playgroud)

ubuntu pip virtualenv pillow

43
推荐指数
5
解决办法
6万
查看次数

ImportError:无法导入在tensorflow上加载图像文件所需的Python Imaging Library(PIL)

我正在做一个关于udacity的深入学习课程.对于第一次分配,当我试图运行低于问题1的脚本时,我收到了这个错误.所以我试图卸载PIL和枕头,然后单独安装,但我没有成功.我需要帮助的人.我正在使用与python笔记本的tensorflow docker图像.

# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
import scipy
import tarfile
from IPython.display import display, Image
from scipy import ndimage
from sklearn.linear_model import LogisticRegression
from six.moves.urllib.request import urlretrieve
from six.moves import cPickle as pickle
# Config the matplotlib backend as plotting inline in IPython
%matplotlib inline 

url = 'http://commondatastorage.googleapis.com/books1000/' …
Run Code Online (Sandbox Code Playgroud)

python python-imaging-library python-2.7 pillow tensorflow

43
推荐指数
3
解决办法
6万
查看次数

从POST解码base64以在PIL中使用

我在Flask中创建了一个简单的API,它接受在base64中编码的图像,然后将其解码以便使用Pillow进行进一步处理.

我看了一些例子(1,2,3),我觉得我得到的过程的要点,但我不断收到一个错误的枕头无法读取我给它的字符串.

这是我到目前为止所得到的:

import cStringIO
from PIL import Image
import base64

data = request.form
image_string = cStringIO.StringIO(base64.b64decode(data['img']))
image = Image.open(image_string)
Run Code Online (Sandbox Code Playgroud)

这给出了错误:

IOError: cannot identify image file <cStringIO.StringIO object at 0x10f84c7a0>
Run Code Online (Sandbox Code Playgroud)

python base64 python-imaging-library flask pillow

40
推荐指数
3
解决办法
3万
查看次数

从字节文件打开PIL图像

我有这个大小为128 x 128像素的图像,RGBA作为字节值存储在我的内存中.但

from PIL import Image

image_data = ... # byte values of the image
image = Image.frombytes('RGBA', (128,128), image_data)
image.show()
Run Code Online (Sandbox Code Playgroud)

抛出异常

ValueError:没有足够的图像数据

为什么?我究竟做错了什么?

python pillow

37
推荐指数
2
解决办法
5万
查看次数