{"id":20619686,"url":"https://github.com/twtrubiks/python-exif-orientation","last_synced_at":"2025-10-10T14:34:09.615Z","repository":{"id":84518986,"uuid":"83302606","full_name":"twtrubiks/python-EXIF-Orientation","owner":"twtrubiks","description":"Automatically determine whether the photo has been rotated, if it is rotated, the photo is turned right","archived":false,"fork":false,"pushed_at":"2019-08-17T05:19:23.000Z","size":337,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T11:55:09.319Z","etag":null,"topics":["exif","jpeg","jpg","orientation","pillow","png","python","tutorial"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twtrubiks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-27T11:24:19.000Z","updated_at":"2023-07-15T00:28:26.000Z","dependencies_parsed_at":"2023-03-04T04:15:24.176Z","dependency_job_id":null,"html_url":"https://github.com/twtrubiks/python-EXIF-Orientation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/twtrubiks/python-EXIF-Orientation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twtrubiks%2Fpython-EXIF-Orientation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twtrubiks%2Fpython-EXIF-Orientation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twtrubiks%2Fpython-EXIF-Orientation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twtrubiks%2Fpython-EXIF-Orientation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twtrubiks","download_url":"https://codeload.github.com/twtrubiks/python-EXIF-Orientation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twtrubiks%2Fpython-EXIF-Orientation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004174,"owners_count":26083688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["exif","jpeg","jpg","orientation","pillow","png","python","tutorial"],"created_at":"2024-11-16T12:12:16.461Z","updated_at":"2025-10-10T14:34:09.610Z","avatar_url":"https://github.com/twtrubiks.png","language":"Python","readme":"# python-EXIF-Orientation\n\n自動判斷照片是否有被旋轉過，如有被旋轉，將照片轉正 📝\n\n* [Youtube Demo](https://youtu.be/o1KjeLUSCB8)\n\n## 特色\n\n* 透過 JPG/JPEG 裡的 EXIF Orientation 屬性，判斷照片是否有被旋轉過。\n\n* 透過 [Pillow](https://pillow.readthedocs.io/en/stable/) 將照片轉正。\n\n\n## 安裝套件\n\n確定電腦有安裝 [Python](https://www.python.org/) 之後\n\nclone 我的簡單範例\n\n```\ngit clone https://github.com/twtrubiks/python-EXIF-Orientation.git\n```\n\n接著請在  cmd (命令提示字元) 輸入以下指令\n\n```\npip install pillow\n```\n\n之前也有寫過一些 [Pillow](https://pillow.readthedocs.io/en/stable/) 的範例，可參考我之前寫的 [pillow-examples](https://github.com/twtrubiks/pillow-examples)\n\n## 說明\n\n關於 JPG/JPEG 裡的 EXIF-Orientation 參數，可以參考這張圖\n\n![alt tag](http://i.imgur.com/jRcq0kC.jpg)\n\n從上圖可以發現\n\n8 代表順時針轉90度\n\n3 代表旋轉180度\n\n6 代表逆時針90度\n\n程式碼思路，只要先找到他們的 EXIF-Orientation 參數 (編號)，也就是往哪個方向旋轉幾度，\n\n再用 [Pillow](https://pillow.readthedocs.io/en/stable/) 反方向旋轉回來即可。\n\n## 使用方法\n\n將要轉正的圖片放在 [input_img](https://github.com/twtrubiks/python-EXIF-Orientation/tree/master/input_img) 資料夾裡\n\n執行\n```\npython app.py\n```\n\n會將轉正的圖片輸出在 [output_img](https://github.com/twtrubiks/python-EXIF-Orientation/tree/master/output_img) 資料夾裡\n\n## 其他說明\n\n這個方法只適用在 JPG/JPEG 裡，並不適用在 PNG裡面。\n\n如果有一張圖片是從 PNG 轉成 JPG/JPEG，裡面的 EXIF-Orientation 這個參數也會消失。\n\n## 執行環境\n\n* Python 3.12.10\n\n## Reference\n\n* [Pillow](https://pillow.readthedocs.io/en/stable/)\n\n## License\n\nMIT license\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwtrubiks%2Fpython-exif-orientation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwtrubiks%2Fpython-exif-orientation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwtrubiks%2Fpython-exif-orientation/lists"}