#1.はじめに
GIMP Python-Fuでイラストを描く その2 レイヤー・色塗り編 - Qiitaの続きです。
全身を描きました。体部分は初心者向けの描き方の本の模写に水着を着せていますが、絵心がないため本よりも下手です。
GIMP 2.10で動作確認をしています。
#2.実行結果
50%縮小表示です。原寸はpixivに載せています。
追記:「ブラシで描画」を選択していてブラシは「1. Pixel」の場合の実行結果です。「鉛筆で描画」や他のブラシの場合には若干結果が変わります。特に、白目の部分までグラデーションが塗られて変になったりします。
#3.変更点
- 全身を描きました。
- 目のハイライトを黒丸で囲むのをやめて大きくしました。
- 顔レイヤーを体レイヤーに変更しました。
- 水着レイヤーを追加しました。
- 補助線レイヤーを追加して非表示にしています。
#4.スクリプト全体
# Python-Fu のサンプル・スクリプト
# GIMP の Python-Fu コンソールにコピペして実行してください
# 画像データの作成
## 指定したサイズで画像データを作成する
### width : 画像データの幅 (px)
### height : 画像データの高さ (px)
def create_image(width, height):
# 画像データを生成
return gimp.Image(width, height, RGB)
# レイヤーの追加
## 指定した名前のレイヤーを新規に作成し、画像データに挿入する
### image : レイヤーを追加する画像データ
### name : 新規に作成するレイヤーの名前(文字列)
def add_layer(image, name):
# レイヤーの作成に必要なパラメータ
width = image.width
height = image.height
type = RGB_IMAGE
opacity = 100
mode = NORMAL_MODE
#
# パラメータをもとにレイヤーを作成
layer = gimp.Layer(image, name, width, height, type, opacity, mode)
#
# レイヤーを背景色で塗りつぶす(GIMP のデフォルトの挙動に合わせています)
layer.fill(1)
#
# 画像データの 0 番目の位置にレイヤーを挿入する
position = 0
image.add_layer(layer, position)
#
return layer
def add_layer_transparent(image, name):
# レイヤーの作成に必要なパラメータ
width = image.width
height = image.height
type = RGBA_IMAGE
opacity = 100
mode = NORMAL_MODE
#
# パラメータをもとにレイヤーを作成
layer = gimp.Layer(image, name, width, height, type, opacity, mode)
#
# レイヤーを透明色で塗りつぶす
layer.fill(TRANSPARENT_FILL)
#
# 画像データの 0 番目の位置にレイヤーを挿入する
position = 0
image.add_layer(layer, position)
#
return layer
# 描画する色を変更する
## パレットの前景色を変更して描画色を設定する
### r : 赤要素 (0-255)
### g : 緑要素 (0-255)
### b : 青要素 (0-255)
### a : 透明度 (0-1.0)
def set_color(r, g, b, a):
color = (r, g, b, a)
pdb.gimp_context_set_foreground(color)
def set_bg_color(r, g, b, a):
color = (r, g, b, a)
pdb.gimp_context_set_background(color)
# 描画する線の太さを変える
## ブラシのサイズを変更して線の太さを設定する
### width : 線の太さ
def set_line_width(width):
pdb.gimp_context_set_brush_size(width)
# アンチエイリアスを設定する
## アンチエイリアスを設定する
### antialias : TRUE:有効、FALSE:無効
def set_antialias(antialias):
pdb.gimp_context_set_antialias(antialias)
# 画像の表示
## 新しいウィンドウを作成し、画像データを表示する
### image : 表示する画像データ
def display_image(image):
gimp.Display(image)
# パス作成
## パスを作成
### image : レイヤーを追加する画像データ
### points : パス座標
### mode : 0:描画しない、1:閉じないストローク(初期値)、2:閉じるストローク、3:塗りつぶし
### delete_path : TRUE:パスを削除する(初期値)、FALSE:パスを残す
def make_path(
image,
points,
mode=1,
delete_path=TRUE,
):
""" パスを作成する。 """
#
# フラグ設定
#
is_draw = FALSE
is_closed = FALSE
is_fill = FALSE
is_stroke = FALSE
if mode == 1: # 閉じないストローク
is_draw = TRUE
is_closed = FALSE
is_fill = FALSE
is_stroke = FALSE
elif mode == 2: # 閉じるストローク
is_draw = TRUE
is_closed = TRUE
is_fill = FALSE
is_stroke = FALSE
elif mode == 3: # 塗りつぶし
is_draw = TRUE
is_closed = TRUE # TRUE/FALSEどちらでも変わらない
is_fill = TRUE
is_stroke = FALSE
elif mode == 4: # 閉じないストローク(アンチエイリアスが効かない)
is_draw = TRUE
is_closed = FALSE # 効かない
is_fill = FALSE
is_stroke = TRUE
elif mode == 5: # 閉じるストローク(アンチエイリアスが効かない)
is_draw = TRUE
is_closed = TRUE
is_fill = FALSE
is_stroke = TRUE
#
vectors = pdb.gimp_vectors_new(image, 'path') # パス新規作成
pdb.gimp_image_add_vectors(image, vectors, 0) # パスを画像に追加
#
# パスとしてストロークを追加
#
stroke_id = pdb.gimp_vectors_stroke_new_from_points(vectors, 0,
len(points), points, is_closed)
#
# パスを表示
#
pdb.gimp_vectors_set_visible(vectors, TRUE)
#
# 描画するよう指定されてたら、パスから選択範囲を作って描画する。
#
if is_draw:
#
# 選択範囲解除
#
pdb.gimp_selection_none(image)
#
# パスから選択範囲作成
#
pdb.gimp_vectors_to_selection(
vectors,
CHANNEL_OP_REPLACE,
TRUE,
FALSE,
0,
0,
)
#
# 前景色で描画
#
drawable = pdb.gimp_image_active_drawable(image)
if is_fill:
pdb.gimp_edit_fill(drawable, FOREGROUND_FILL)
elif is_stroke:
pdb.gimp_edit_stroke(drawable)
else:
pdb.gimp_drawable_edit_stroke_item(drawable, vectors)
#
# 選択範囲解除
#
pdb.gimp_selection_none(image)
#
# パス削除が指定されていたらパスを削除する。
#
if delete_path:
# パス削除
#
pdb.gimp_image_remove_vectors(image, vectors)
#
return
def get_absolute_point(list):
""" """
rlist = []
for pos in list:
if len(pos) == 6:
(x, y, rx1, ry1, rx2, ry2) = pos
x1 = x + rx1
y1 = y + ry1
x2 = x + rx2
y2 = y + ry2
else:
(x, y) = pos
x1 = x
y1 = y
x2 = x
y2 = y
rlist.extend([
x1,
y1,
x,
y,
x2,
y2,
])
return rlist
# パス作成(相対座標指定)
## パスを作成
### image : レイヤーを追加する画像データ
### points : パス座標
### mode : 0:描画しない、1:最後を閉じないストローク(初期値)、2:最後を閉じるストローク、3:塗りつぶし
### delete_path : TRUE:パスを削除する(初期値)、FALSE:パスを残す
def make_path_relative(
image,
points,
mode=1,
delete_path=TRUE,
):
""" パスを作成する。 """
new_points = get_absolute_point(points)
make_path(image, new_points, mode, delete_path)
# 補助線を描画
def draw_auxiliary_line(image, auxiliary_line_layer):
pdb.gimp_image_set_active_layer(image, auxiliary_line_layer)
set_line_width(1)
set_color(127, 127, 127, 1.0)
make_path_relative(image, [(200, 300), (600, 300)], 1, TRUE)
make_path_relative(image, [(200, 500), (600, 500)], 1, TRUE)
make_path_relative(image, [(200, 700), (600, 700)], 1, TRUE)
make_path_relative(image, [(200, 900), (600, 900)], 1, TRUE)
make_path_relative(image, [(200, 1100), (600, 1100)], 1, TRUE)
make_path_relative(image, [(200, 1300), (600, 1300)], 1, TRUE)
make_path_relative(image, [(200, 1500), (600, 1500)], 1, TRUE)
# 目を描画
def draw_eyes(image, eyes_layer):
pdb.gimp_image_set_active_layer(image, eyes_layer)
#
# 値は(アンカーX, Y[, 制御開始点増分X, Y, 制御終了点増分X, Y])
#
set_line_width(6)
set_color(255, 255, 255, 1.0)
# 右白目
points7 = [
(425, 418, 0, 0, +8, -7),
(440, 408, -7, +3, +10, +4),
(460, 434, -10, -22, 0, 0),
(440, 450, +8, 0, -12, 0),
(432, 450, 0, 0, 0, 0),
]
make_path_relative(image, points7, 3, TRUE)
# 右目 ※透明だとなぜかgimp_fuzzy_select()が効かないので内側を白で塗りつぶす(白目で描いているけど念のため)
points2 = [
(452, 430, 0, -10, 0, +10),
(440, 450, +8, 0, -8, 0),
(428, 430, 0, +10, 0, -10),
(440, 410, -8, 0, +8, 0),
]
set_color(255, 255, 255, 1.0)
make_path_relative(image, points2, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points2, 2, TRUE)
pdb.gimp_fuzzy_select(eyes_layer, 440, 430, 150, 2, TRUE, 0, 0, 0)
set_color(0, 0, 63, 1.0)
set_bg_color(127, 223, 223, 1.0)
pdb.gimp_edit_blend(eyes_layer, FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, REPEAT_NONE, FALSE, FALSE, 0, 0, TRUE, 440, 420, 440, 430)
pdb.gimp_selection_clear(image)
set_color(0, 0, 0, 1.0)
# 右瞳孔
points2_2 = [
(445, 430, 0, -5, 0, +5),
(440, 438, +3 , 0, -3, 0),
(435, 430, 0, +5, 0, -5),
(440, 422, -3, 0, +3, 0),
]
make_path_relative(image, points2_2, 3, TRUE)
set_color(255, 255, 255, 1.0)
# 左白目
points8 = [
(375, 418, 0, 0, -8, -7),
(360, 408, +7, +3, -10, +4),
(340, 434, +10, -22, 0, 0),
(360, 450, -8, 0, +12, 0),
(368, 450, 0, 0, 0, 0),
]
make_path_relative(image, points8, 3, TRUE)
# 左目 ※透明だとなぜかgimp_fuzzy_select()が効かないので内側を白で塗りつぶす(白目で描いているけど念のため)
points3 = [
(372, 430, 0, -10, 0, +10),
(360, 450, +8, 0, -8, 0),
(348, 430, 0, +10, 0, -10),
(360, 410, -8, 0, +8, 0),
]
set_color(255, 255, 255, 1.0)
make_path_relative(image, points3, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points3, 2, TRUE)
pdb.gimp_fuzzy_select(eyes_layer, 360, 430, 150, 2, TRUE, 0, 0, 0)
set_color(0, 0, 63, 1.0)
set_bg_color(127, 223, 223, 1.0)
pdb.gimp_edit_blend(eyes_layer, FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, REPEAT_NONE, FALSE, FALSE, 0, 0, TRUE, 360, 420, 360, 430)
pdb.gimp_selection_clear(image)
set_color(0, 0, 0, 1.0)
# 左瞳孔
points3_2 = [
(365, 430, 0, -5, 0, +5),
(360, 438, +3 , 0, -3, 0),
(355, 430, 0, +5, 0, -5),
(360, 422, -3, 0, +3, 0),
]
make_path_relative(image, points3_2, 3, TRUE)
set_line_width(6)
# 右眉毛
points5 = [
(420, 400, 0, 0, +10, -12),
(440, 385, -10, +3, +15, +8),
(470, 415, -15, -22, 0, 0),
]
make_path_relative(image, points5, 1, TRUE)
# 左眉毛
points6 = [
(380, 400, 0, 0, -10, -12),
(360, 385, +10, +3, -15, +8),
(330, 415, +15, -22, 0, 0),
]
make_path_relative(image, points6, 1, TRUE)
set_line_width(6)
# 右目上
points7 = [
(425, 418, 0, 0, +8, -7),
(440, 408, -7, +3, +10, +4),
(460, 434, -10, -22, 0, 0),
]
make_path_relative(image, points7, 1, TRUE)
# 左目上
points8 = [
(375, 418, 0, 0, -8, -7),
(360, 408, +7, +3, -10, +4),
(340, 434, +10, -22, 0, 0),
]
make_path_relative(image, points8, 1, TRUE)
#
set_line_width(4)
#
# 右目光
points2_3 = [
(447, 420, 0, -2, 0, +2),
(444, 423, +2 , 0, -2, 0),
(441, 420, 0, +2, 0, -2),
(444, 417, -2, 0, +2, 0),
]
set_color(255, 255, 255, 1.0)
make_path_relative(image, points2_3, 3, TRUE)
#set_color(0, 0, 0, 1.0)
#make_path_relative(image, points2_3, 2, TRUE)
# 左目光
points2_4 = [
(367, 420, 0, -2, 0, +2),
(364, 423, +2 , 0, -2, 0),
(361, 420, 0, +2, 0, -2),
(364, 417, -2, 0, +2, 0),
]
set_color(255, 255, 255, 1.0)
make_path_relative(image, points2_4, 3, TRUE)
#set_color(0, 0, 0, 1.0)
#make_path_relative(image, points2_4, 2, TRUE)
# 短い線を引くと太くぼやけるので、線幅を小さくする
set_line_width(1.5)
#
# 右目尻
points7_2 = [
(460, 434, 0, 0, 0, 0),
(458, 437, 0, 0, 0, 0),
]
make_path_relative(image, points7_2, 1, TRUE)
# 左目尻
points8_2 = [
(340, 434, 0, 0, 0, 0),
(342, 437, 0, 0, 0, 0),
]
make_path_relative(image, points8_2, 1, TRUE)
# 後髪を描画
def draw_back_hair(image, back_hair_layer):
pdb.gimp_image_set_active_layer(image, back_hair_layer)
#
set_line_width(6)
set_color(115, 66, 41, 1.0)
points1 = [
# 髪(右外側)
(400, 270, 0, 0, 0, 0),
(450, 280, -10, -8, 0, 0),
(470, 290, 0, 0, +15, +8),
(500, 330, -5, -10, +10, +15),
(510, 370, 0, 0, 0, 0),
(509, 430, 0, 0, 0, 0),
(504, 500, 0, 0, 0, 0),
(499, 570, 0, 0, 0, 0),
# 髪(左外側)
(301, 570, 0, 0, 0, 0),
(296, 500, 0, 0, 0, 0),
(291, 430, 0, 0, 0, 0),
(290, 370, 0, 0, 0, 0),
(300, 330, -10, +15, +5, -10),
(330, 290, -15, +8, 0, 0),
(350, 280, 0, 0, +10, -8),
(400, 270, 0, 0, 0, 0),
]
make_path_relative(image, points1, 3, TRUE)
#
set_line_width(6)
set_color(0, 0, 0, 1.0)
# 髪(右外側)
points12 = [
(400, 270, 0, 0, 0, 0),
(450, 280, -10, -8, 0, 0),
(470, 290, 0, 0, +15, +8),
(500, 330, -5, -10, +10, +15),
(510, 370, 0, 0, 0, 0),
(509, 430, 0, 0, 0, 0),
(504, 500, 0, 0, 0, 0),
(499, 570, 0, 0, 0, 0),
]
make_path_relative(image, points12, 1, TRUE)
#
#
# 髪(左外側)
points13 = [
(400, 270, 0, 0, 0, 0),
(350, 280, +10, -8, 0, 0),
(330, 290, 0, 0, -15, +8),
(300, 330, +5, -10, -10, +15),
(290, 370, 0, 0, 0, 0),
(291, 430, 0, 0, 0, 0),
(296, 500, 0, 0, 0, 0),
(301, 570, 0, 0, 0, 0),
]
make_path_relative(image, points13, 1, TRUE)
# 体を描画
def draw_body(image, body_layer):
pdb.gimp_image_set_active_layer(image, body_layer)
#
# 短い線を引くと太くぼやけるので、線幅を小さくする
set_line_width(6)
set_color(240, 221, 195, 1.0)
# 首塗り
points10 = [
(425, 491, 0, 0, 0, 0),
(424, 500, 0, 0, 0, 0),
(376, 500, 0, 0, 0, 0),
(375, 491, 0, 0, 0, 0),
]
make_path_relative(image, points10, 3, TRUE)
# 右腕塗り
points10 = [
(424, 500, -1, -5, +10, +20),
#(520, 524, -60, -15, +10, +20),
(520, 524, -20, -7, +10, +10),
(535, 680, -5, -20, +5, +20),
(555, 730, -3, -10, +3, +15),
(555, 870, +5, -20, -2, +10),
(550, 920, +3, -5, -5, +10),
(510, 980, 0, 0, 0, 0),
(505, 980, 0, 0, 0, 0),
(526, 860, 0, 0, 0, 0),
(530, 850, 0, 0, 0, 0),
(500, 760, 0, 0, 0, 0),
(495, 700, 0, 0, 0, 0),
(490, 675, 0, 0, 0, 0),
]
make_path_relative(image, points10, 3, TRUE)
# 左腕塗り
points11 = [
(376, 500, +1, -5, -10, +20),
#(280, 524, +60, -15, -10, +20),
(280, 524, +20, -7, -10, +10),
(265, 680, +5, -20, -5, +20),
(245, 730, +3, -10, -3, +15),
(245, 870, -5, -20, +2, +10),
(250, 920, -3, -5, +5, +10),
(290, 980, 0, 0, 0, 0),
(295, 980, 0, 0, 0, 0),
(274, 860, 0, 0, 0, 0),
(270, 850, 0, 0, 0, 0),
(300, 760, 0, 0, 0, 0),
(305, 700, 0, 0, 0, 0),
(310, 675, 0, 0, 0, 0),
]
make_path_relative(image, points11, 3, TRUE)
# 胸真ん中少し上、ウエスト右から股右
points10 = [
(400, 630, 0, 0, 0, 0),
(484, 676, 0, 0, 0, 0),
(470, 740, 0, -30, 0, +30),
(496, 796, -10, -10, 0, +20),
(440, 880, 0, 0, -15, +15),
(400, 900, +10, 0, 0, 0),
]
make_path_relative(image, points10, 3, TRUE)
# 胸真ん中少し上、ウエスト左から股左
points11 = [
(400, 630, 0, 0, 0, 0),
(316, 676, 0, 0, 0, 0),
(330, 740, 0, -30, 0, +30),
(304, 796, +10, -10, 0, +20),
(360, 880, 0, 0, +15, +15),
(400, 900, -10, 0, 0, 0),
]
make_path_relative(image, points11, 3, TRUE)
# ウエスト右から右足塗り
points10 = [
(496, 796, 0, 0, 0, 0),
(530, 880, 0, -30, 0, +20),
(470, 1150, 0, -50, 0, +20),
(480, 1250, 0, -20, 0, +20),
(450, 1460, 0, 0, 0, 0),
(485, 1510, 0, -20, 0, +20),
(450, 1530, 0, 0, 0, 0),
(440, 1520, 0, 0, -5, 0),
(420, 1500, 0, 0, 0, 0),
(420, 1500, -10, 0, 0, 0),
(400, 1490, 0, 0, 0, 0),
(400, 1485, 0, 0, 0, 0),
(405, 1470, 0, 0, 0, 0),
(403, 1450, 0, 0, 0, 0),
(410, 1430, 0, -10, 0, 0),
(410, 1400, 0, -20, 0, +10),
(400, 1320, 0, -10, 0, +20),
(400, 1270, 0, -10, 0, +10),
(410, 1220, 0, -10, 0, +10),
(400, 1180, 0, -10, 0, +10),
(400, 1130, 0, -15, 0, +10),
(405, 1070, 0, -15, 0, +15),
(405, 1000, 0, -10, 0, +15),
(400, 950, 0, -15, 0, +10),
(420, 895, 0, 0, -5, +10),
(440, 880, 0, 0, 0, 0),
]
make_path_relative(image, points10, 3, TRUE)
# ウエスト左から左足塗り
points11 = [
(304, 796, 0, 0, 0, 0),
(270, 880, 0, -30, 0, +20),
(330, 1150, 0, -50, 0, +20),
(320, 1250, 0, -20, 0, +20),
(350, 1460, 0, 0, 0, 0),
(315, 1510, 0, -20, 0, +20),
(350, 1530, 0, 0, 0, 0),
(360, 1520, 0, 0, +5, 0),
(380, 1500, 0, 0, 0, 0),
(380, 1500, +10, 0, 0, 0),
(400, 1490, 0, 0, 0, 0),
(400, 1485, 0, 0, 0, 0),
(395, 1470, 0, 0, 0, 0),
(397, 1450, 0, 0, 0, 0),
(390, 1430, 0, -10, 0, 0),
(390, 1400, 0, -20, 0, +10),
(400, 1320, 0, -10, 0, +20),
(400, 1270, 0, -10, 0, +10),
(390, 1220, 0, -10, 0, +10),
(400, 1180, 0, -10, 0, +10),
(400, 1130, 0, -15, 0, +10),
(395, 1070, 0, -15, 0, +15),
(395, 1000, 0, -10, 0, +15),
(400, 950, 0, -15, 0, +10),
(380, 895, 0, 0, +5, +10),
(360, 880, 0, 0, 0, 0),
]
make_path_relative(image, points11, 3, TRUE)
set_line_width(6)
# 首左下から右胸塗り
points10 = [
(376, 500, 0, 0, 0, 0),
(424, 500, -1, -5, +10, +20),
(475, 516, 0, 0, 0, 0),
(485, 560, -5, -10, +5, +10),
(505, 590, -10, -20, +10, +20),
(515, 640, 0, -20, -5, +20),
(475, 680, +30, -5, -30, 0),
(415, 650, +20, +30, -20, -30),
(400, 635, 0, 0, 0, 0),
]
make_path_relative(image, points10, 3, TRUE)
# 首右下から左胸塗り
points11 = [
(424, 500, 0, 0, 0, 0),
(376, 500, +1, -5, -10, +20),
(325, 516, 0, 0, 0, 0),
(315, 560, +5, -10, -5, +10),
(295, 590, +10, -20, -10, +20),
(285, 640, 0, -20, +5, +20),
(325, 680, -30, -5, +30, 0),
(385, 650, -20, +30, +20, -30),
(400, 635, 0, 0, 0, 0),
]
make_path_relative(image, points11, 3, TRUE)
# 尻右
points10 = [
(423, 890, 0, 0, -5, +10),
(400, 898, +10, 0, 0, 0),
(400, 900, 0, 0, 0, 0),
(412, 912, 0, 0, 0, 0),
]
make_path_relative(image, points10, 3, TRUE)
# 尻左
points11 = [
(377, 890, 0, 0, +5, +10),
(400, 898, -10, 0, 0, 0),
(400, 900, 0, 0, 0, 0),
(388, 912, 0, 0, 0, 0),
]
make_path_relative(image, points11, 3, TRUE)
set_color(0, 0, 0, 1.0)
# 首(右)から右腕外側
points10 = [
(425, 491, 0, 0, 0, 0),
(424, 500, -1, -5, +10, +20),
#(520, 524, -60, -15, +10, +20),
(520, 524, -20, -7, +10, +10),
(535, 680, -5, -20, +5, +20),
(555, 730, -3, -10, +3, +15),
(555, 870, +5, -20, -2, +10),
(550, 920, +3, -5, -5, +10),
(510, 980, 0, 0, 0, 0),
(505, 980, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 首(左)から左腕外側
points11 = [
(375, 491, 0, 0, 0, 0),
(376, 500, +1, -5, -10, +20),
#(280, 524, +60, -15, -10, +20),
(280, 524, +20, -7, -10, +10),
(265, 680, +5, -20, -5, +20),
(245, 730, +3, -10, -3, +15),
(245, 870, -5, -20, +2, +10),
(250, 920, -3, -5, +5, +10),
(290, 980, 0, 0, 0, 0),
(295, 980, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
# 首(右) 欠けるのでもう一度描く
points10 = [
(425, 491, 0, 0, 0, 0),
(424, 500, -1, -5, +10, +20),
(428, 508, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 首(左)
points11 = [
(375, 491, 0, 0, 0, 0),
(376, 500, +1, -5, -10, +20),
(372, 508, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(2)
# 右鎖骨
points10 = [
(455, 518, 0, 0, 0, 0),
(420, 518, 0, 0, -10, 0),
(400, 530, +10, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 左鎖骨
points11 = [
(345, 518, 0, 0, 0, 0),
(380, 518, 0, 0, +10, 0),
(400, 530, -10, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(6)
# 右胸
points10 = [
#(475, 516, 0, 0, 0, 0),
(485, 560, -5, -10, +5, +10),
(505, 590, -10, -20, +10, +20),
(515, 640, 0, -20, -5, +20),
(475, 680, +30, -5, -30, 0),
(415, 650, +20, +30, -20, -30),
(400, 635, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 左胸
points11 = [
#(325, 516, 0, 0, 0, 0),
(315, 560, +5, -10, -5, +10),
(295, 590, +10, -20, -10, +20),
(285, 640, 0, -20, +5, +20),
(325, 680, -30, -5, +30, 0),
(385, 650, -20, +30, +20, -30),
(400, 635, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
# 右腕内側
points10 = [
(490, 675, 0, 0, 0, 0),
(495, 700, 0, 0, 0, 0),
(500, 760, 0, 0, 0, 0),
(530, 850, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 左腕内側
points11 = [
(310, 675, 0, 0, 0, 0),
(305, 700, 0, 0, 0, 0),
(300, 760, 0, 0, 0, 0),
(270, 850, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(3)
# 右手内側
points10 = [
(535, 830, 0, 0, 0, 0),
(526, 860, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 左手内側
points11 = [
(265, 830, 0, 0, 0, 0),
(274, 860, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(2)
# 右肘裏
points10 = [
(515, 700, 0, 0, 0, 0),
(513, 715, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 左肘裏
points11 = [
(285, 700, 0, 0, 0, 0),
(287, 715, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(6)
# 短い線を引くと太くぼやけるので、線幅を小さくする
set_line_width(2)
# 右脇
points10 = [
(505, 560, 0, 0, 0, 0),
(499, 578, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 左脇
points11 = [
(295, 560, 0, 0, 0, 0),
(301, 578, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(6)
# ウエスト右から右足外側
points10 = [
(484, 676, 0, 0, 0, 0),
(470, 740, 0, -30, 0, +30),
(490, 785, -10, -10, +20, +20),
(530, 880, 0, -30, 0, +20),
(470, 1150, 0, -50, 0, +20),
(480, 1250, 0, -20, 0, +20),
(450, 1460, 0, 0, 0, 0),
(485, 1510, 0, -20, 0, +20),
(450, 1530, 0, 0, 0, 0),
(440, 1520, 0, 0, -5, 0),
(420, 1500, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# ウエスト左から左足外側
points11 = [
(316, 676, 0, 0, 0, 0),
(330, 740, 0, -30, 0, +30),
(310, 785, +10, -10, -20, +20),
(270, 880, 0, -30, 0, +20),
(330, 1150, 0, -50, 0, +20),
(320, 1250, 0, -20, 0, +20),
(350, 1460, 0, 0, 0, 0),
(315, 1510, 0, -20, 0, +20),
(350, 1530, 0, 0, 0, 0),
(360, 1520, 0, 0, +5, 0),
(380, 1500, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(4)
# 右足指
points10 = [
(460, 1526, 0, 0, 0, 0),
(460, 1520, 0, 0, 0, 0),
(455, 1510, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
points10 = [
(469, 1524, 0, 0, 0, 0),
(469, 1518, 0, 0, 0, 0),
(464, 1508, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
points10 = [
(477, 1520, 0, 0, 0, 0),
(477, 1514, 0, 0, 0, 0),
(472, 1504, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
points10 = [
(481, 1514, 0, 0, 0, 0),
(481, 1508, 0, 0, 0, 0),
(476, 1498, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 左足指
points10 = [
(340, 1526, 0, 0, 0, 0),
(340, 1520, 0, 0, 0, 0),
(345, 1510, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
points10 = [
(331, 1524, 0, 0, 0, 0),
(331, 1518, 0, 0, 0, 0),
(336, 1508, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
points10 = [
(323, 1520, 0, 0, 0, 0),
(323, 1514, 0, 0, 0, 0),
(328, 1504, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
points10 = [
(319, 1514, 0, 0, 0, 0),
(319, 1508, 0, 0, 0, 0),
(324, 1498, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
set_line_width(4)
# 右足内側付け根 途切れるので重ねて描く
points10 = [
(430, 888, 0, 0, 0, 0),
(420, 895, 0, 0, -5, +10),
(400, 950, 0, -15, 0, +10),
]
make_path_relative(image, points10, 1, TRUE)
# 左足内側付け根
points11 = [
(370, 888, 0, 0, 0, 0),
(380, 895, 0, 0, +5, +10),
(400, 950, 0, -15, 0, +10),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(6)
# 右足内側
points10 = [
#(440, 880, 0, 0, 0, 0),
(420, 895, 0, 0, -5, +10),
(400, 950, 0, -15, 0, +10),
(405, 1000, 0, -10, 0, +15),
(405, 1070, 0, -15, 0, +15),
(400, 1130, 0, -15, 0, +10),
(400, 1180, 0, -10, 0, +10),
(410, 1220, 0, -10, 0, +10),
(400, 1270, 0, -10, 0, +10),
(400, 1320, 0, -10, 0, +20),
(410, 1400, 0, -20, 0, +10),
(410, 1430, 0, -10, 0, 0),
(403, 1450, 0, 0, 0, 0),
(405, 1470, 0, 0, 0, 0),
(400, 1485, 0, 0, 0, 0),
(400, 1490, 0, 0, 0, 0),
(420, 1500, -10, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 左足内側
points11 = [
#(360, 880, 0, 0, 0, 0),
(370, 888, 0, 0, 0, 0),
(380, 895, 0, 0, +5, +10),
(400, 950, 0, -15, 0, +10),
(395, 1000, 0, -10, 0, +15),
(395, 1070, 0, -15, 0, +15),
(400, 1130, 0, -15, 0, +10),
(400, 1180, 0, -10, 0, +10),
(390, 1220, 0, -10, 0, +10),
(400, 1270, 0, -10, 0, +10),
(400, 1320, 0, -10, 0, +20),
(390, 1400, 0, -20, 0, +10),
(390, 1430, 0, -10, 0, 0),
(397, 1450, 0, 0, 0, 0),
(395, 1470, 0, 0, 0, 0),
(400, 1485, 0, 0, 0, 0),
(400, 1490, 0, 0, 0, 0),
(380, 1500, +10, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(3)
# 右膝外側
points10 = [
(455, 1140, 0, 0, 0, +5),
(450, 1160, 0, 0, 0, -5),
]
make_path_relative(image, points10, 1, TRUE)
# 左膝外側
points11 = [
(345, 1140, 0, 0, 0, +5),
(350, 1160, 0, 0, 0, -5),
]
make_path_relative(image, points11, 1, TRUE)
# 右膝内側
points10 = [
(420, 1130, 0, 0, 0, +20),
(430, 1170, 0, 0, 0, -20),
]
make_path_relative(image, points10, 1, TRUE)
# 左膝内側
points11 = [
(380, 1130, 0, 0, 0, +20),
(370, 1170, 0, 0, 0, -20),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(4)
# 股右
points10 = [
(440, 880, 0, 0, -15, +15),
(400, 900, +10, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 股左
points11 = [
(360, 880, 0, 0, +15, +15),
(400, 900, -10, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(3)
# 尻右
points10 = [
(400, 900, 0, 0, 0, 0),
(410, 910, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 尻左
points11 = [
(400, 900, 0, 0, 0, 0),
(390, 910, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
set_line_width(6)
#
# 輪郭
points1 = [
(400, 300),
(410, 301),
(420, 303),
(430, 306),
(440, 310),
(450, 315),
(460, 320),
(470, 328),
(480, 339),
(485, 345),
(491, 360),
(491, 370),
(490, 380),
(488, 390, 0, 0, 0, 0),
(485, 400, 0, 0, 0, 0),
(482, 410, 0, 0, 0, 0),
(479, 420, 0, 0, 0, 0),
(475, 430, 0, 0, 0, 0),
(470, 440, 0, 0, 0, 0),
(465, 458, 0, 0, 0, 0),
(460, 470, 0, 0, 0, 0),
(450, 480, +5, -5, -5, +5),
(400, 500, +5, 0, -5, 0),
(350, 480, +5, +5, -5, -5),
(340, 470, 0, 0, 0, 0),
(335, 458, 0, 0, 0, 0),
(330, 440, 0, 0, 0, 0),
(325, 430, 0, 0, 0, 0),
(321, 420, 0, 0, 0, 0),
(318, 410, 0, 0, 0, 0),
(315, 400, 0, 0, 0, 0),
(312, 390, 0, 0, 0, 0),
(310, 380),
(309, 370),
(309, 360),
(315, 345),
(320, 339),
(330, 328),
(340, 320),
(350, 315),
(360, 310),
(370, 306),
(380, 303),
(390, 301),
(400, 300),
]
set_color(240, 221, 195, 1.0)
make_path_relative(image, points1, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points1, 1, TRUE)
#
# 右耳
points16 = [
(475, 430, 0, 0, 0, 0),
(480, 434, 0, 0, 0, 0),
(478, 440, 0, 0, 0, 0),
(475, 447, 0, 0, 0, 0),
(467, 450, 0, 0, 0, 0),
]
set_color(240, 221, 195, 1.0)
make_path_relative(image, points16, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points16, 1, TRUE)
#
# 左耳
points17 = [
(325, 430, 0, 0, 0, 0),
(320, 434, 0, 0, 0, 0),
(322, 440, 0, 0, 0, 0),
(325, 447, 0, 0, 0, 0),
(333, 450, 0, 0, 0, 0),
]
set_color(240, 221, 195, 1.0)
make_path_relative(image, points17, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points17, 1, TRUE)
#
# 鼻
points9 = [
(401, 448, 0, 0, 0, 0),
(399, 450, 0, 0, 0, 0),
(401, 452, 0, 0, 0, 0),
]
make_path_relative(image, points9, 1, TRUE)
# 口
points4 = [
(380, 470, 0, 0, 0, 0),
(385, 473, 0, 0, 0, 0),
(400, 475, 0, 0, 0, 0),
(415, 473, 0, 0, 0, 0),
(420, 470, 0, 0, 0, 0),
]
make_path_relative(image, points4, 1, TRUE)
#
#
set_line_width(1.5)
#
set_color(234, 145, 152, 1.0)
# 右頬
make_path_relative(image, [(430, 460), (435, 455)], 1, TRUE)
make_path_relative(image, [(434, 460), (439, 455)], 1, TRUE)
make_path_relative(image, [(438, 460), (443, 455)], 1, TRUE)
make_path_relative(image, [(442, 460), (447, 455)], 1, TRUE)
make_path_relative(image, [(446, 460), (451, 455)], 1, TRUE)
#
# 左頬
make_path_relative(image, [(350, 460), (355, 455)], 1, TRUE)
make_path_relative(image, [(354, 460), (359, 455)], 1, TRUE)
make_path_relative(image, [(358, 460), (363, 455)], 1, TRUE)
make_path_relative(image, [(362, 460), (367, 455)], 1, TRUE)
make_path_relative(image, [(366, 460), (371, 455)], 1, TRUE)
# 前髪を描画
def draw_bangs(image, bangs_layer):
pdb.gimp_image_set_active_layer(image, bangs_layer)
#
set_line_width(6)
set_color(115, 66, 41, 1.0)
# 髪塗りつぶし
points1_2 = [
# 頭頂
(400, 270),
# 髪(右内側)1
(400, 305, 0, 0, +4, +30),
(405, 370, -1, -35, +25, +1),
(450, 376, -20, -5, -2, -31),
(440, 315, +8, +30, 0, 0),
(440, 315),
]
make_path_relative(image, points1_2, 3, TRUE)
# 髪塗りつぶし
points1_4 = [
# 頭頂
(400, 270),
# 髪(右内側)1
(400, 305, 0, 0, -4, +30),
(395, 370, +1, -35, -25, +1),
(350, 376, +20, -5, +2, -31),
(360, 315, -8, +30, 0, 0),
(360, 315),
]
make_path_relative(image, points1_4, 3, TRUE)
#
# 髪(右内側)2塗りつぶし
points14_2 = [
(440, 315, 0, 0, +10, +30),
(456, 378, -6, -33, +16, +4),
(488, 390, -16, -8, 0, 0),
(495, 380), # 輪郭線を消すために一番下以外輪郭より少し大きめ(X+5)
(496, 370),
(496, 360),
(490, 345),
(485, 339),
(475, 328),
(465, 320),
(455, 315),
(445, 310),
(435, 306),
(425, 303),
(415, 301),
(400, 300),
]
make_path_relative(image, points14_2, 3, TRUE)
# 髪(左内側)2塗りつぶし
points15_2 = [
(360, 315, 0, 0, -10, +30),
(344, 378, +6, -33, -16, +4),
(312, 390, +16, -8, 0, 0),
(305, 380), # 輪郭線を消すために一番下以外輪郭より少し大きめ(X-5)
(304, 370),
(304, 360),
(310, 345),
(315, 339),
(325, 328),
(335, 320),
(345, 315),
(355, 310),
(365, 306),
(375, 303),
(385, 301),
(400, 300),
]
make_path_relative(image, points15_2, 3, TRUE)
#
set_color(0, 0, 0, 1.0)
#
# 髪(右内側)1
points14_1 = [
(400, 305, 0, 0, +4, +30),
(405, 370, -1, -35, +25, +1),
(450, 376, -20, -5, -2, -31),
(440, 315, +8, +30, 0, 0),
]
make_path_relative(image, points14_1, 1, TRUE)
#
# 髪(右内側)2
points14_2 = [
(440, 315, 0, 0, +10, +30),
(456, 378, -6, -33, +16, +4),
(488, 390, -16, -8, 0, 0),
]
make_path_relative(image, points14_2, 1, TRUE)
#
# 髪(左内側)1
points15_1 = [
(400, 305, 0, 0, -4, +30),
(395, 370, +1, -35, -25, +1),
(350, 376, +20, -5, +2, -31),
(360, 315, -8, +30, 0, 0),
]
make_path_relative(image, points15_1, 1, TRUE)
#
# 髪(左内側)2
points15_2 = [
(360, 315, 0, 0, -10, +30),
(344, 378, +6, -33, -16, +4),
(312, 390, +16, -8, 0, 0),
]
make_path_relative(image, points15_2, 1, TRUE)
def draw_swimsuit(image, swimsuit_layer):
pdb.gimp_image_set_active_layer(image, swimsuit_layer)
set_line_width(3)
# 尻右
points10 = [
(423, 890, 0, 0, -5, +10),
(400, 898, +10, 0, 0, 0),
(400, 900, 0, 0, 0, 0),
(412, 912, 0, 0, 0, 0),
]
set_color(29, 49, 86, 1.0)
make_path_relative(image, points10, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points10, 1, TRUE)
# 尻左
points11 = [
(377, 890, 0, 0, +5, +10),
(400, 898, -10, 0, 0, 0),
(400, 900, 0, 0, 0, 0),
(388, 912, 0, 0, 0, 0),
]
set_color(29, 49, 86, 1.0)
make_path_relative(image, points11, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points11, 1, TRUE)
# 胸真ん中少し上、ウエスト右から股右
points10 = [
(400, 630, 0, 0, 0, 0),
(484, 676, 0, 0, 0, 0),
(470, 740, 0, -30, 0, +30),
(496, 796, -10, -10, 0, +20),
(440, 880, 0, 0, -15, +15),
(400, 900, +10, 0, 0, 0),
]
set_color(29, 49, 86, 1.0)
make_path_relative(image, points10, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points10, 1, TRUE)
# 胸真ん中少し上、ウエスト左から股左
points11 = [
(400, 630, 0, 0, 0, 0),
(316, 676, 0, 0, 0, 0),
(330, 740, 0, -30, 0, +30),
(304, 796, +10, -10, 0, +20),
(360, 880, 0, 0, +15, +15),
(400, 900, -10, 0, 0, 0),
]
set_color(29, 49, 86, 1.0)
make_path_relative(image, points11, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points11, 1, TRUE)
# ウエストライン右
points10 = [
(454, 676, 0, 0, 0, 0),
(440, 740, 0, -30, 0, +30),
(449, 868, -10, -10, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# ウエストライン左
points10 = [
(346, 676, 0, 0, 0, 0),
(360, 740, 0, -30, 0, +30),
(351, 868, +10, -10, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
set_line_width(2)
# 股布ライン
points1 = [
(449, 868, 0, 0, 0, 0),
(351, 868, 0, 0, 0, 0),
]
make_path_relative(image, points1, 1, TRUE)
set_line_width(3)
# 右胸
points10 = [
(400, 570, 0, 0, +25, 0),
(455, 514, 0, +30, 0, 0),
(475, 516, 0, 0, 0, 0),
(485, 560, -5, -10, +5, +10),
(505, 590, -10, -20, +10, +20),
(515, 640, 0, -20, -5, +20),
(475, 680, +30, -5, -30, 0),
(415, 650, +20, +30, -20, -30),
(400, 635, 0, 0, 0, 0),
]
set_color(29, 49, 86, 1.0)
make_path_relative(image, points10, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points10, 1, TRUE)
# 左胸
points11 = [
(400, 570, 0, 0, -25, 0),
(345, 514, 0, +30, 0, 0),
(325, 516, 0, 0, 0, 0),
(315, 560, +5, -10, -5, +10),
(295, 590, +10, -20, -10, +20),
(285, 640, 0, -20, +5, +20),
(325, 680, -30, -5, +30, 0),
(385, 650, -20, +30, +20, -30),
(400, 635, 0, 0, 0, 0),
]
set_color(29, 49, 86, 1.0)
make_path_relative(image, points11, 3, TRUE)
set_color(0, 0, 0, 1.0)
make_path_relative(image, points11, 1, TRUE)
# 胸ライン右
points10 = [
(509, 602, 0, 0, 0, 0),
(492, 648, +20, 0, -5, +20),
(458, 679, 0, 0, 0, 0),
]
make_path_relative(image, points10, 1, TRUE)
# 胸ライン左
points11 = [
(291, 602, 0, 0, 0, 0),
(308, 648, -20, 0, +5, +20),
(342, 679, 0, 0, 0, 0),
]
make_path_relative(image, points11, 1, TRUE)
# メイン
def main():
set_bg_color(255, 255, 255, 1.0)
image = create_image(800, 1600)
back_layer = add_layer(image, "背景")
auxiliary_line_layer = add_layer_transparent(image, "補助線")
back_hair_layer = add_layer_transparent(image, "後髪")
body_layer = add_layer_transparent(image, "体")
eyes_layer = add_layer_transparent(image, "目")
bangs_layer = add_layer_transparent(image, "前髪")
swimsuit_layer = add_layer_transparent(image, "水着")
set_color(0, 0, 0, 1.0)
set_line_width(6)
set_antialias(TRUE)
#
draw_auxiliary_line(image, auxiliary_line_layer)
pdb.gimp_drawable_set_visible(auxiliary_line_layer, FALSE) # 補助線レイヤー非表示
# 髪を描いた後にgimp_fuzzy_select()をすると選択範囲が黒目の線まで広がるので、先に目を描く
draw_eyes(image, eyes_layer)
draw_back_hair(image, back_hair_layer)
draw_body(image, body_layer)
draw_bangs(image, bangs_layer)
draw_swimsuit(image, swimsuit_layer)
#
display_image(image)
main()
#5.スクリプト実行方法
5 分で始める GIMP Python-Fu - Qiitaと同じ方法で実行して下さい。
#6.参考
Amazon.co.jp: 萌えキャラクターの描き方 顔・からだ編 (マンガの技法書) eBook: 伊原達矢, 角丸つぶら: Kindleストア
#7.その他
ハイライトと影を追加しました。
→GIMP Python-Fuでイラストを描く その4 ハイライト・影編 - Qiita