小编Chr*_*ris的帖子

缩小图像时保留时间戳

我的数码相机以非常高的分辨率拍摄照片,我有一个PIL脚本将它们缩小到800x600(或600x800).但是,结果文件保留原始时间戳会很好.我在文档中注意到我可以在PIL的图像保存方法中使用File对象而不是名称,但我不知道这是否有帮助.

我的代码基本上是名称,ext = os.path.splitext(filename)

# open an image file (.bmp,.jpg,.png,.gif) you have in the working folder
image = Image.open(filename)

width = 800
height = 600

w, h = image.size
if h > w:
    width = 600
    height = 800

name = name + ".jpg"
shunken = image.resize((width, height), Image.ANTIALIAS)
shunken.save(name)
Run Code Online (Sandbox Code Playgroud)

感谢您提供任何帮助!

python python-imaging-library

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

将字符与Elm中的字符串进行比较

我想循环遍历字符串的字符,看看每个字符串是否包含在另一个字符串中.但是,String.toList返回字符列表,而不是String.contains函数不允许的字符串列表.将Char传递给toString没有帮助,是否有其他方法可以实现这一目标,还是我只需要另一种方法?

> String.contains (toString 'a') "asdf"
False : Bool
Run Code Online (Sandbox Code Playgroud)

elm

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

标签 统计

elm ×1

python ×1

python-imaging-library ×1