python-----贴图 和 报错:OSError: image file is truncated (8 bytes not processed)的处理
将一张图片贴到另一张图片上,代码如下:
from PIL import Image
import os
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
path = r'E:\work\taikang_shangtang\test5\1.35W/'
save_path = r'E:\work\taikang_shangtang\test5\1.35W_resize/'
os.makedirs(save_path,exist_ok=True) for pic in os.listdir(path):
jgz = Image.open(path + pic)
img = Image.open("F:/temp/upload_pic/huabu.jpg")
img.paste(jgz,(196,139))
img.save(save_path + pic)
其中:(196,139) 是位置。
ps:如果不加下面两行代码,可能会报错:OSError: image file is truncated (8 bytes not processed)
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
python-----贴图 和 报错:OSError: image file is truncated (8 bytes not processed)的处理的更多相关文章
- OSError: image file is truncated (28 bytes not processed)
解决办法: 在代码中添加两行 from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True
- python抓取不得姐动图(报错 urllib.error.HTTPError: HTTP Error 403: Forbidden)
抓取不得姐动图(报错) # -*- coding:utf-8 -*- #__author__ :kusy #__content__:文件说明 #__date__:2018/7/23 17:01 imp ...
- Python创建文件报错OSError:[Errno 22] Invalid argument处理
问题: windows平台下使用python open函数w模式打开文件报错“OSError: [Errno 22] Invalid argument: '../news/“消费升维”成零售业新风口? ...
- pandas.read_csv() 报错 OSError: Initializing from file failed,报错原因分析和解决方法
今天调用pandas读取csv文件时,突然报错“ OSError: Initializing from file failed ”,我是有点奇怪的,以前用的好好的,read_csv(path)方法不是 ...
- captcha库报错"OSError: cannot open resource"
问题描述 在win平台上python虚拟环境下使用captcha库生成验证码报错OSError: cannot open resource 代码 from captcha.image import I ...
- Python virtualenv安装库报错SSL: CERTIFICATE_VERIFY_FAILED
Python virtualenv安装库报错SSL: CERTIFICATE_VERIFY_FAILED 问题描述 使用pip按照virtualenv报错,如下: pip install virtua ...
- xhprof查看性能测试图一直报错:failed to execute cmd: " dot -Tpng"多种因素解决方案
xhprof查看性能测试图一直报错:failed to execute cmd: ” dot -Tpng”多种因素解决方案最近在新环境进行php代码性能测试,用了xhprof这个工具,搭建好以后,点击 ...
- python 读取配置文件总是报错 configparser.NoSectionError: No section:
本文为作者原创,禁止转载,违者必究法律责任!!! python 读取配置文件总是报错 configparser.NoSectionError: No section: 无论是 python2的版本,还 ...
- Python djangorestframework安装库报错SSL: CERTIFICATE_VERIFY_FAILED
Python djangorestframework 安装库报错SSL: CERTIFICATE_VERIFY_FAILED 问题描述 使用pip按照virtualenv报错,如下: pip inst ...
随机推荐
- 两个很实用很方便的函数核心及用法{(lower_bound)+(max_element))~~
(1) 关于 lower_bound(a,a+n,x)-a的用法: 求x在数组a中的 ...
- SOJ 4467 easyproblem 2【欧拉函数 最大公因数和】
这题wa的莫名其妙,郁闷了一下午,队友暴力一发跟我答案也是一样.后来队友说试试把%I64d换成%lld,果然一下ac...(暴露了在soj做题少.. ac之后排在ranklist的最后一名...目前也 ...
- 洛谷——P1608 路径统计
P1608 路径统计 题目描述 “RP餐厅”的员工素质就是不一般,在齐刷刷的算出同一个电话号码之后,就准备让HZH,TZY去送快餐了,他们将自己居住的城市画了一张地图,已知在他们的地图上,有N个地方, ...
- Spring的Web MVC框架
以下内容引用自http://wiki.jikexueyuan.com/project/spring/web-mvc-framework.html: Spring web MVC框架提供了模型-视图-控 ...
- firedac数据集的序列和还原
procedure TForm1.Button1Click(Sender: TObject);var stream, stream2: TMemoryStream; buf: TBytes;begin ...
- 关于maven多个模块的build顺序 [INFO] Reactor Build Order
对于一个maven项目,如果有多个模块,那么它们的执行顺序是什么样的呢? 在执行mvn操作的时候,你可以看到如下信息,这个便是maven的build顺序 那么maven是如何决定顺序的呢?如下: 在多 ...
- poj 3468 A Simple Problem with Integers(线段树、延迟更新)
A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 74705 ...
- [Node.js] Write or Append to a File in Node.js with fs.writeFile and fs.writeFileSync
In node.js, you can require fs, and then call fs.writeFile with the filename, and data to write to t ...
- nyoj473 A^B Problem (高速幂)
题目473 题目信息 执行结果 pid=473" style="text-decoration:none; color:rgb(55,119,188)">本题排行 ...
- 西门子PLC学习笔记六-(Step7指令简单介绍)
1.指令操作数 指令操作数由操作标示符和參数组成. 操作标识符由主标识符和辅标识符组成. 主标识符有:I(输入过程影像寄存器).Q(输出过程映像寄存器).M(位寄存器).PI(外部输入寄存器).PQ( ...