漫画のフキダシの文字を楽に入れたいのでGIMPに縦書きテキストを4つ追加するプラグインを作った。
単純に四つだけ追加する。
メニューのレイヤーからadd tategaki text 4をクリックで動作する。
一番下のレイヤーサイズにテキストの位置は依存する。
以下をコピペしてファイル名前をadd_tategaki_text_4.pyにしてutf-8で保存後、GIMPのプラグインフォルダーに入れれば使える。
プラグインフォルダーはGIMPを起動し「編集」→「設定」→「フォルダー」→「プラグイン」で確認の事。
フォントはMSゴシックを指定してあるが変えたい人は以下のフォント指定の場所を書き換える事。
フォント名はGIMPでテキストボックスを選択してツールオプションの好みのフォントを設定する時の名前をコピペすればよい。
#!/usr/bin/python # -*- coding: utf-8 -*- from gimpfu import * def tategaki_text_4(): #一番下のレイヤーの情報取得 image = gimp.image_list()[0] new_left_up_x = [image.width / 8 , image.width / 8 , 5 * image.width / 8 , 5 * image.width / 8] new_left_up_y = [image.height / 8 , 5 * image.height / 8 , image.height / 8 , 5 * image.height / 8] #フォント指定 font = "MS Gothic" #源暎アンチックを使いたい人はフォントをインストール後以下の行の#を消す #font = "GenEi Antique Pv5 Medium" for i in range(4): #テキストレイヤーを追加する text = unicode("■テキストレイヤー" , "utf-8") text_layer = pdb.gimp_text_layer_new(image, text, font, 32, 0) # #テキストレイヤーの位置指定 text_layer.set_offsets(new_left_up_x[i], new_left_up_y[i]) # #新規作成したテキストレイヤーを有効にする image.add_layer(text_layer) # #テキストレイヤーを縦書きにする pdb.gimp_text_layer_set_base_direction(text_layer,2) # #テキストレイヤーのサイズを変更する text_layer_height = image.height / 4 text_layer_width = image.width / 6 pdb.gimp_text_layer_resize(text_layer, text_layer_width, text_layer_height) # register( "add_tategaki_text_4", "add tategaki text 4", "add tategaki text 4", "katsumi", "katsumi", "2022", "add tategaki text 4", "", [], [], tategaki_text_4, menu = "<Image>/Layer" ) main()