맥·모바일 개발Mac & mobile

exif-orientation-guard

EXIF 방향 태그 때문에 저장 크기와 표시 크기가 다른 이미지를 찾아 고칩니다. 픽셀에 방향을 구워 넣습니다.

GitHub에서 보기View on GitHub

어떤 문제를 푸나The problem

저장된 크기와 화면에 보이는 크기는 다를 수 있습니다. 어떤 도구는 방향 태그를 따르고 어떤 도구는 무시해서, 올린 사진이 가로로 측정되고 세로로 보이는 일이 생깁니다.

normalize.py는 픽셀을 실제로 회전하고 방향 태그만 지우며, --check는 폴더 안에 방향 태그가 남은 파일이 있는지 CI에서 확인할 수 있게 해 줍니다.

이런 분께 맞습니다Who it is for

스크린샷이나 사진의 크기를 검증하는 파이프라인을 만들거나 OCR 좌표가 어긋나는 문제를 겪은 개발자.

무엇을 하나What it does

  • 이미지를 회전하고 방향 태그만 지우며, ICC 프로필과 다른 EXIF 필드는 유지하고 팔레트 PNG의 색도 보존합니다.
  • 저장 크기에서 표시 크기로 바뀐 값을 출력합니다.
  • --check는 태그가 남은 파일이 있으면 종료 코드 1, 폴더가 아니거나 읽을 수 없는 파일이 있으면 2입니다.
  • JPEG는 품질 95로 다시 인코딩하고 애니메이션 이미지는 거부합니다.

직접 돌려 본 출력Real output

저장소의 examples 폴더를 실행한 결과입니다.

$ bash examples/demo.sh
# The file is stored 200x100 but tag-aware viewers show it 100x200 (tag-ignoring tools still see 200x100). Find such files:
$ python3 scripts/normalize.py --check .demo-tmp
TAGGED  .demo-tmp/photo.png: orientation=6 stored=(200, 100) displayed=(100, 200)
1 file(s) carry an orientation tag
[exit 1]

# Bake the orientation into the pixels and drop the tag:
$ python3 scripts/normalize.py .demo-tmp/photo.png .demo-tmp/fixed.png
stored (200, 100) -> displayed (100, 200)
[exit 0]

$ python3 scripts/normalize.py --check .demo-tmp
clean (1 image(s) checked)
[exit 0]

알아둘 한계Limits

  • Pillow가 필요합니다.
  • XMP 같은 EXIF가 아닌 메타데이터는 옮기지 않습니다.

받아서 쓰기Get it

# 저장소를 받습니다
git clone https://github.com/Kein-chronicle/exif-orientation-guard.git

# Claude Code 스킬로 쓰려면 이 폴더 이름으로 받습니다
git clone https://github.com/Kein-chronicle/exif-orientation-guard.git ~/.claude/skills/exif-orientation-guard

정보Info

분류Category
맥·모바일 개발Mac & mobile
형태Type
명령줄 도구Command-line tool
라이선스License
MIT
필요한 것Requires
Python 3.10 이상, Pillow
저장소Repository
exif-orientation-guard
토픽Topics
exif image-processing python pillow ios photos orientation claude-skills

2026-10-18 기준: 저장소의 테스트를 로컬에서 실행해 통과했고, 예제 출력은 저장소의 examples 폴더를 실제로 실행한 결과입니다.

공유하기Share

문자Message 네이버 블로그Naver Blog X Facebook