728x90
반응형
https://github.com/python-pillow/Pillow/issues/1380
PNG write is failing due to IOError · Issue #1380 · python-pillow/Pillow
Folks, I believe I have found an file (JPG) that is causing PIL to report a false IO Error, and write a zero byte file. Now the following code is working fine for other JPG, PNG, etc files: (Please...
github.com
from PIL import Image
image_file = Image.open("./error_img.png")
image_file.convert('RGB').save("./error_img.png", "PNG", optimize=True)
PNG가 지원하지 않는 CMYK mode로 저장되어 있어서 생긴 문제
RGB포맷으로 변경 후 열어보니 이미지 사이즈는 동일.
기존의 32bit -> 24bit로 줄어들고 용량이 줄어들긴 했으나 큰 차이는 없어보임
728x90
반응형
'사소한 Tip . 오류 해결법' 카테고리의 다른 글
[vscode] 파일 탭으로 열 때 새 창에서 열기/미리보기 해제 (0) | 2023.06.01 |
---|---|
[vscode] notion / github readme / file(project) structure 표시 방법 (0) | 2023.04.25 |
[Log 저장] 학습 과정에서 로그파일 작성 train.log / tee 명령어 (0) | 2023.03.17 |
Tensor 내 특정 값 찾기 (0) | 2023.03.16 |
한글 자모 분리될 때 (0) | 2023.03.14 |