{"id":34513045,"url":"https://github.com/haozhexu/bor","last_synced_at":"2026-05-24T23:04:27.750Z","repository":{"id":79859156,"uuid":"118557906","full_name":"haozhexu/bor","owner":"haozhexu","description":"A script for adding border to image with custom options","archived":false,"fork":false,"pushed_at":"2024-06-09T11:23:22.000Z","size":4281,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-09T12:35:03.555Z","etag":null,"topics":["exif","imagemagic","photoeditor","photography","shell","shell-script"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haozhexu.png","metadata":{"files":{"readme":"README.cn.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-01-23T04:31:47.000Z","updated_at":"2024-06-09T11:23:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"27b76e4b-b1e7-4b3f-af41-6517606f3749","html_url":"https://github.com/haozhexu/bor","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/haozhexu/bor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haozhexu%2Fbor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haozhexu%2Fbor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haozhexu%2Fbor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haozhexu%2Fbor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haozhexu","download_url":"https://codeload.github.com/haozhexu/bor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haozhexu%2Fbor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27994454,"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-12-24T02:00:07.193Z","response_time":83,"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","imagemagic","photoeditor","photography","shell","shell-script"],"created_at":"2025-12-24T04:13:13.883Z","updated_at":"2025-12-24T04:13:16.212Z","avatar_url":"https://github.com/haozhexu.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bor\n一个可定制的给图片加边框的脚本\n\n(English version please see [here](README.md))\n\n我的博客上常常会发一些自己拍的照片[haozhexu.me](https://haozhexu.me)，有时需要显示照片的拍摄参数，这个脚本便是用来给照片加边框，同时可以定制显示拍摄参数，以及定制照片的尺寸和质量压缩。\n\n早年间为了避免指纹，照片的相纸会刻意留出白框，而拿到相片的人往往会在空白处写下拍摄日期及地点等信息。后来的宝丽来和富士拍立得也沿用了这一风格。\n\n这个脚本需要用到[ImageMagic®](https://www.imagemagick.org)，如果要把EXIF信息从生成的照片里移除的话，[ExifTool](https://www.sno.phy.queensu.ca/~phil/exiftool/)也是需要的，在Mac上两者都可以用[Homebrew](https://brew.sh/)安装:\n\n```\nbrew install imagemagic\nbrew install exiftool\n```\n\nbor.sh 是个命令行脚本，可以接收若干选项，图片文件名是必须的，生成的图片文件名若没指定，则默认为_原始文件名_bor.文件格式_。\n\n例子：\n\n**按指定像素缩放**\n\n```\n./bor.sh -r 800x600 photo.jpg\n```\n\n**按百分比缩放**\n\n```\n./bor.sh -r 80% photo.jpg\n```\n\n**按总像素量缩放**\n\n缩小photo.jpg，使得总像素(长乘以宽)不超过4096。\n\n```\n./bor.sh -r 4096@ photo.jpg\n```\n\n**降低图片质量**\n\n把photo.jpg的画质降低到80%\n\n```\n./bor.sh -q 80 photo.jpg\n```\n\n**按指定像素大小加边框**\n\n加20x20像素的边框\n\n```\n./bor.sh -b 20x20 photo.jpg\n```\n\n**按原始相片的比例加边框**\n\n给photo.jpg加边框，左右边框大小是相片宽的5%，上下边框大小是相片高的10%。\n\n```\n./bor.sh -b 5%x10% photo.jpg\n```\n\n**在边框上写下相片的拍摄参数(EXIF)**\n\n加上指定的拍摄参数，中等字体大小\n\n```\n./bor.sh -b 5%x10% -e cameramodel,focallength,fnumber,exptime,isospeed,stripexif -f medium photo.jpg\n```\n\n可选的字体大小：\n\n* small: 20%边框大小\n* medium: 30%边框大小\n* large: 50%边框大小\n\n可选的EXIF参数 (用在 -e 后，以逗号分开):\n\n* cameramodel\n* focallength\n* fnumber\n* exptime\n* isospeed\n* stripexif - 这不是一个拍摄参数，如果指定的话，生成的相片文件不会包含原始相片的EXIF信息\n\n**所有选项都指定的例子**\n\n```\n./bor.sh -b 5%x10% -e cameramodel,focallength,fnumber,exptime,isospeed,stripexif -f medium -r 80% -q 70 photo.jpg photo_output.jpg\n```\n\n## run_for_all.sh\n\n\u003e ./run_for_all.sh '~/Photos/*.jpg' '_bor'\n\n将`~/Photos`目录中所有jpg图片加上边框以及EXIF信息，输出为每个文件的文件名加上`_bor`后缀。\n\n```\nphoto001.jpg\nphoto002.jpg\n…\nphoto009.jpg\n```\n\n生成：\n\n```\nphoto001_bor.jpg\nphoto002_bor.jpg\n…\nphoto009_bor.jpg\n```\n\n## 生成的相片\n\n![生成的相片](./photo_output.jpg \"生成的相片\")\n\n我会持续改善这个脚本，如果有任何建议请[告诉我](mailto:haozhe.xu3@gmail.com)。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaozhexu%2Fbor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaozhexu%2Fbor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaozhexu%2Fbor/lists"}