问题描述
这是我要执行的代码。我正在 Plex 中编写代理
htmlimages = html.xpath('//div[@class="entry"]/p//img/@src') # only need first two images
self.log('UPDATE:: here1 %s',htmlimages[index])
img_file = urllib.urlopen(htmlimages[index])
im = BytesIO(img_file.read())
image = Image.open(im)
width,height = image.size
height = 1000
self.log('SELF:: Original Image Size [{0},{1}]'.format(width,height))
baseWidth = 800
baseHeight = 1200
widthPercent = float(baseWidth/width)
Operation = 'Crop' if width <= baseWidth else 'Resize'
newWidth = width if Operation == 'Crop' else width * widthPercent
newHeight = int(newWidth * 1.5 if Operation == 'Crop' else height * widthPercent)
Operation = 'Crop' if newHeight > baseHeight else 'Resize'
self.log('SELF:: Proposed Image Size [{0},{1}] by {2}'.format(width,height,Operation))
image = image.crop((0,newWidth,newHeight))
一切正常,直到我尝试执行 image.crop 并抛出以下错误
文件“C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-5a0a3e4b2\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\api\agentkit.py” ,第 1093 行,更新 agent.update(obj,media,lang,**kwargs) 文件“C:\Users\jphud\AppData\Local\Plex Media Server\Plug-ins\BestExclusivePorn.bundle\Contents\Code_init.py”,第 440 行,更新中 image = image.crop((0,newHeight)) 文件“C:\Users\jphud\AppData\Local\Plex Media Server\Plug-ins\BestExclusivePorn.bundle\Contents\Libraries\Shared\PIL\Image.py”,第 763 行,裁剪中 self.load() 文件“C:\Users\jphud\AppData\Local\Plex Media Server\Plug-ins\BestExclusivePorn.bundle\Contents\Libraries\Shared\PIL\ImageFile.py”,第 164 行,加载中 self.load_prepare() 文件“C:\Users\jphud\AppData\Local\Plex Media Server\Plug-ins\BestExclusivePorn.bundle\Contents\Libraries\Shared\PIL\ImageFile.py”,第 231 行,在 load_prepare self.im = Image.core.new(self.mode,self.size) 文件“C:\Users\jphud\AppData\Local\Plex Media Server\Plug-ins\BestExclusivePorn.bundle\Contents\Libraries\Shared\PIL\Image.py”,第 37 行,getattr raise ImportError("未安装 _imaging C 模块") 导入错误:未安装 _imaging C 模块
我看了几十页和解决方案,首先是因为我在 32 位环境中使用了 64 位库。我解决了这个问题……但我不知所措。
我什至按照此处的帖子提取了 _imaging.* 文件并将它们插入到 LIB 中,我使用的安装文件是 Pillow-2.7.0-py2.7-win32.egg,通过将 .egg 重命名为 .zip
我的 python 版本是 sys.version_info(major=2,minor=7,micro=17,releaselevel='final',serial=0)
有没有人有办法解决这个问题??
或者其他可行的方法,我尝试过 WAND、ImageMagick,但我遇到了 32/64 位的问题...
有没有办法强制 pip 安装任何图像处理库的 32 位版本??
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)