Copying an image to some directory

This question already has an answer here:

  • How do I copy a file in python? 14 answers

  • You don't need opencv to do this. You can use the shutil library.

    import shutil
    shutil.copyfile('path/to/1.jpg', 'new/path/to/1.jpg')
    

    Note that the destination path must specify the filename too. If you don't want this, you can use shutil.copy2 which lets you specify a directory as the destination.

    shutil.copy2('path/to/1.jpg', 'new/path/to/dir')
    
    链接地址: http://www.djcxy.com/p/42332.html

    上一篇: Python复制文件,但保持原来的

    下一篇: 将图像复制到某个目录