デジタルカメラで撮影した写真を縮小し、フレームを付けた写真に変換します。
フレーム下部に Exif から取得した著作権者名、メーカー、カメラ、レンズ、撮影データがプリントされます。
go install github.com/mitsugu/addframe@<tag name>
- 最新のリリース zip ファイル をダウンロードする。
- zip ファイルを展開する。
- Linux 版、MacOS 版は addframe にリネームする。
- 実行ファイルを任意のディレクトリに置く。
- addframe が置かれたディレクトリへのパスを通します。あるいは addframe 実行可能ファイルをパスが通ったディレクトリに置きます。
// addframe.json example
{
"path": {
"imagemagick": "/path/to//magick",
"exiftool": "/bin/exiftool"
},
"length": 1280,
"frame": {
"top": 32,
"left": 32,
"right": 32,
"bottom": 128,
"color": "#3f3f3f"
},
"text": {
"direction": "South",
"margin": 0,
"dpi": 96,
"element": [{
"font": "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
"color": "white",
"size": 24,
"margintop": 32,
"marginbottom": 4
}, {
"font": "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
"color": "white",
"size": 24,
"margintop": 4,
"marginbottom": 4
}, {
"font": "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc",
"color": "#cfcfcf",
"size": 16,
"margintop": 4,
"marginbottom": 4
}]
}
}
- path.imagemagick
ImageMagick の magick コマンドへのパス。絶対パスと相対パスを指定できます。
Windows ユーザーの場合は、.exe 拡張子を忘れずに含めてください。 - path.exiftool
exiftool へのパス。絶対パスと相対パスを指定できます。
Windows ユーザーの場合は、.exe 拡張子を忘れずに含めてください。 - length
画像の長辺のサイズをピクセル単位で指定します。 - frame.top
フレーム上端の幅をピクセル単位で指定します。 - frame.left
フレームの左側の幅をピクセル単位で指定します。 - frame.right
フレームの右側の幅をピクセル単位で指定します。 - frame.bottom
フレーム下端の幅をピクセル単位で指定します。
addframe の最新バージョンでは、プログラムによって自動的に計算され、無視されます。 - frame.color
ImageMagick 方式を使用して枠の色を指定します。 - text.direction
テキストを配置する場所を指定します。ImageMagick 方式を使用して指定します。 - text.margin
テキスト領域のマージンをピクセル単位で指定します。
text.direction が South の場合は 0 を推奨します。
SouthEast の場合、右マージンをピクセル単位で指定します。
SouthWest の場合、左マージンをピクセル単位で指定します。 - text.dpi
ディスプレイのDPIを指定します。 ImageMagickのDPIとディスプレイのDPIが異なるとフォントサイズが異常になりますので必ず指定してください。 - text.element
テキスト 3 行分の書式指定ですので、必ずすべて 指定してください。 - text.element.font
フォントファイルへのパスを指定します。 ttc、ttf、otf フォント ファイルを指定できます。 - text.element.color
ImageMagick 形式のフォントカラーを指定します。 - text.element.size
フォントのサイズをポイント数で指定します。ピクセル数ではないので注意してください。 - text.element.margintop
Specifies the top margin of a line of text.
The display position of the line is mainly adjusted using margintop and marginbottom. - text.element.marginbottom
Specifies the bottom margin of a line of text.
The display position of the line is mainly adjusted using margintop and marginbottom.
addframe [--config congiguration_file_path] <--input input_file_path> <--output output_file_path>
or
addframe [-c congiguration_file_path] <-i input_file_path> <-o output_file_path>
- --config (-c)
オプション。省略した場合は、カレントディレクトリにある設定ファイル addframe.json が使用されます。
省略した場合でも設定ファイル自体が不要になるわけではありませんのでご注意ください。 - --input (-i)
フレームを追加する画像ファイル。通常は JPEG です。Exif には以下のデータが記録されている必要があります。
- Copyright
- Author
- Camera Maker
- Camera Model
- Lens Model
- ISO Speed
- F Number
- Shutter Speed
- --output (-o)
フレームを追加した結果のファイルへのパス。
注)
多くのカメラは Exif に著作権者と著作者を記録しません。そのようなカメラをご利用の場合は私が作成した addcopyright というプログラムを使うことで画像ファイルの Exif に著作権者と著作者の情報を書き込むことができます。
https://github.com/mitsugu/addframe
楽しんで!! 😀