[ Python ] 이미지를 gif로 바꾸는 방법

2019. 5. 11. 16:24분석 Python/Visualization

728x90

Python 안에서 사진을 gif로 만들고 싶을 때가 있다. 

나도 그 부분에 대해서 하고 싶었지만 알지 못했는데, 오늘 다른 코드를 보다가 방법을 알게되서 공유하려고 한다.

os.system('convert -delay 15 -loop 0 {0}/posterior_predictive_map_frame*png {0}/posterior_predictive.gif'
                          .format(logdir))

이런식으로 특정 dir에서 원하는 것만 posterior_predictive_map_frame*png 같이 조건을 줘서 만들어줄 수 있다.

Loop에 간단하게 쓸 수 있는 구조라서 좋은 것 같다.

이만!

728x90