代码之家  ›  专栏  ›  技术社区  ›  espenhogbakk

如何在python中从图像文件夹生成电影胶片图像?

  •  3
  • espenhogbakk  · 技术社区  · 17 年前

    我想做同样的事情 this python中的(ruby代码)用于我正在开发的Django项目。我想制作一个 filmstrip image 文件夹中有X个图像。

    2 回复  |  直到 9 年前
        1
  •  4
  •   S.Lott    17 年前

    你能记住这样的事情吗? Use PIL to make a "contact sheet" of images ?

    也许这里还有其他更接近你想要的东西: http://code.activestate.com/recipes/tags/graphics/

        2
  •  1
  •   Community Mohan Dere    8 年前

    这是一个包装函数 接触片 功能 S.Lott 提到。

    #!/usr/bin/env python
    
    import os, os.path
    from contactsheet import make_contact_sheet
    
    def make_film_strip(fnames,
                       (photow,photoh),
                       (marl,mart,marr,marb),
                       padding):
        return make_contact_sheet(fnames,
                                  (1, len(fnames)),
                                  (photow,photoh),
                                  (marl,mart,marr,marb),
                                  padding)
    

    它假设 recipe 保存为 contactsheet.py 。用法是:

    fstrip = filmstrip.make_film_strip(filmstrip.fnames, (120, 120), (0,0,0,0), 0)
    fstrip.save('/path/to/file.format')
    

    经过测试。