0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GIMP Python-Fuでイラストを描く その4 ハイライト・影編

Last updated at Posted at 2019-12-13

#1.はじめに

GIMP Python-Fuでイラストを描く その3 全身編 - Qiitaの続きです。ハイライトと影を追加しました。
GIMP 2.10で動作確認をしています。

#2.実行結果

50%縮小表示です。原寸はpixivに載せています。
「ブラシで描画」を選択した場合の実行結果です。「鉛筆で描画」の場合には若干結果が変わります。
追記:レイヤーをマージする時に鎖骨が消えていたのを修正しました。
20191214_mizuki_50%_3.png

#3.スクリプト変更部分・主要部分

ブラシを自動で選択するようにしました。但し、「鉛筆で描画」を「ブラシで描画」に切り替えることができないため、実行前に「ブラシで描画」を選択しておく必要があります。
「2. Hardness 050」(51x51)は胸のハイライトに、「1. Pixel」(3x3)はそれ以外の全てに使用しています。

    # ブラシ「1. Pixel」(3x3)を選択。「ブラシで描画」に切り替えることはできないので事前に変更して下さい。
    pdb.gimp_context_set_brush("1. Pixel")
    # ブラシ「2. Hardness 050」(51x51)を選択
    pdb.gimp_context_set_brush("2. Hardness 050")

レイヤーグループを画像(トップレベル)に追加する関数です。体と水着のレイヤーグループをメイン関数で作成しています。

# レイヤーグループを画像に追加する
def add_layer_group(image, name):
    layer_group = pdb.gimp_layer_group_new(image)
    image.add_layer(layer_group, 0)
    layer_group.name = name
    return layer_group

子レイヤーをレイヤーグループに追加する関数です。

# 子レイヤーをレイヤーグループに追加する
def add_child_layer_transparent(image, parent_group, 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
    pdb.gimp_image_insert_layer(image, layer, parent_group, position)
    #
    return layer

メイン関数のレイヤーグループと子レイヤーの作成部分です。

    body_layer_group = add_layer_group(image, "体グループ")
    back_hair_layer = add_child_layer_transparent(image, body_layer_group, "後髪")
    body_layer = add_child_layer_transparent(image, body_layer_group, "")
    bust_layer = add_child_layer_transparent(image, body_layer_group, "")
    face_layer = add_child_layer_transparent(image, body_layer_group, "")
    eyes_layer = add_child_layer_transparent(image, body_layer_group, "")
    bangs_layer = add_child_layer_transparent(image, body_layer_group, "前髪")
    swimsuit_layer_group = add_layer_group(image, "水着グループ")
    swimsuit_waist_layer = add_child_layer_transparent(image, swimsuit_layer_group, "水着ウエスト")
    swimsuit_bust_layer = add_child_layer_transparent(image, swimsuit_layer_group, "水着バスト")

髪のハイライトの描画で、GIMP Python-Fuで不透明部分を選択してマスクを作成する - QiitaGIMP Python-Fuでマスクを削除する - Qiitaのマスク作成、削除を行って、ハイライトが髪からはみ出さないようにしています。胸の描画でも、胸からハイライトと影がはみ出さないように使用しています。

    # 不透明部分を選択する
    pdb.gimp_image_select_item(image, 0, bangs_layer)
    # 選択範囲からマスクを作成する
    mask = pdb.gimp_layer_create_mask(bangs_layer, ADD_SELECTION_MASK)
    # マスクをレイヤーに追加する
    pdb.gimp_layer_add_mask(bangs_layer, mask)
    # マスク編集を無効にする(マスクでない部分を編集する)
    pdb.gimp_layer_set_edit_mask(bangs_layer, FALSE)
    set_color(204, 146, 117, 1.0)
    # 髪ハイライト右
    points1 = [
	(500, 320, 0, 0, -30, +30),
	(400, 345, +20, -3, 0, 0),
	(400, 355, 0, 0, +30, -3),
	(500, 330, -10, +30, 0, 0),
        ]
    make_path_relative(image, points1, 3, TRUE)
    # 髪ハイライト左
    points1 = [
	(300, 320, 0, 0, +30, +30),
	(400, 345, -20, -3, 0, 0),
	(400, 355, 0, 0, -30, -3),
	(300, 330, +10, +30, 0, 0),
        ]
    make_path_relative(image, points1, 3, TRUE)
    # マスクをレイヤーから削除する
    pdb.gimp_layer_remove_mask(bangs_layer, MASK_APPLY)

胸レイヤーをすぐ下の体レイヤーと統合しています。この後に元のbody_layerを使用するとエラーになるので、new_body_layerを使用する必要があります。統合した後に首の影を描画しています。

    # 胸レイヤーをすぐ下の体レイヤーと統合する
    new_body_layer = pdb.gimp_image_merge_down(image, bust_layer, EXPAND_AS_NECESSARY)

#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

# レイヤーグループを画像に追加する
def add_layer_group(image, name):
    layer_group = pdb.gimp_layer_group_new(image)
    image.add_layer(layer_group, 0)
    layer_group.name = name
    return layer_group

# 子レイヤーをレイヤーグループに追加する
def add_child_layer_transparent(image, parent_group, 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
    pdb.gimp_image_insert_layer(image, layer, parent_group, 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 = [
        (439, 420,  0, -2,  0, +2),
        (436, 423, +2 , 0, -2,  0),
        (433, 420,  0, +2,  0, -2),
        (436, 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 = [
        (359, 420,  0, -2,  0, +2),
        (356, 423, +2 , 0, -2,  0),
        (353, 420,  0, +2,  0, -2),
        (356, 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)
    set_color(247, 195, 156, 1.0)
    # 右腕影
    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),

        (510, 962,  0, 0,  0, 0),

        (540, 920,  -5, +10,  +3, -5),
        (545, 870,  -2, +10,  +5, -20),
        (545, 730,  +3, +15,  -3, -10),
        (525, 680,  +5, +20,  -5, -20),
        (510, 524,  +10, +10,  -20, -7),
        ]
    make_path_relative(image, points10, 3, TRUE)
    # 左腕影
    points11 = [
        (300, 671,  0, 0,  0, 0),
        (295, 700,  0, 0,  0, 0),
        (290, 760,  0, 0,  0, 0),
        (268, 838,  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)
    set_color(240, 221, 195, 1.0)
    # 胸真ん中少し上、ウエスト右から股右
    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)
    set_color(255, 255, 255, 1.0)
    # 右太ももハイライト
    points10 = [
        (464, 900,  0, 0,  0, 0),
        (446, 985,  0, 0,  0, 0),
        (434, 1070,  0, 0,  0, 0),
        (452, 985,  0, 0,  0, 0),
        ]
    make_path_relative(image, points10, 3, TRUE)
    # 左太ももハイライト
    points11 = [
        (322, 900,  0, 0,  0, 0),
        (333, 985,  0, 0,  0, 0),
        (350, 1070,  0, 0,  0, 0),
        (339, 985,  0, 0,  0, 0),
        ]
    make_path_relative(image, points11, 3, TRUE)
    set_line_width(6)
    set_color(247, 195, 156, 1.0)
    # ウエスト右から右足影
    points10 = [
        #(400, 630,  0, 0,  0, 0),

        (484, 676,  0, 0,  0, 0),
        #(470, 740,  0, -30,  0, +30),
        (471, 740,  0, -30,  0, +30),
        #(496, 796,  -10, -10,  0, +20),
        #(496, 794,  -10, -10,  0, +20),
        (496, 794,  -10, -10,  0, 0),

        #(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),

        (440, 1458,  0, 0,  0, 0),
        (460, 1250,  0, +20,  0, -20),
        (450, 1150,  0, +20,  0, -50),
        (510, 880,  0, +20,  0, -30),

        (488, 813,  0, 0,  0, 0),
        (458, 740,  0, +30,  0, -30),
        (475, 676,  0, 0,  0, 0),
        ]
    make_path_relative(image, points10, 3, TRUE)
    # 左足影
    points11 = [
        (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),

        #(340, 880,  0, 0,  0, 0),
        #(360, 895,  0, 0,  +5, -10),
        (380, 950,  0, +10,  0, -15),
        (375, 1000,  0, +15,  0, -10),
        (375, 1070,  0, +15,  0, -15),
        (380, 1130,  0, +10,  0, -15),
        (380, 1180,  0, +10,  0, -10),
        (370, 1220,  0, +10,  0, -10),
        (380, 1270,  0, +10,  0, -10),
        (380, 1320,  0, +20,  0, -10),
        (370, 1400,  0, +10,  0, -20),
        #(370, 1430,  0, +10,  0, 0),

        (377, 1450,  0, 0,  0, 0),
        #(375, 1470,  0, 0,  0, 0),
        (380, 1485,  0, 0,  0, 0),
        #(380, 1490,  0, 0,  0, 0),
        #(360, 1500,  +10, 0,  0, 0),
        (351, 1516,  +10, 0,  0, 0),
        ]
    make_path_relative(image, points11, 3, TRUE)
    set_line_width(6)
    # 尻右
    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 = [
        (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)

# 胸を描画(胸の影がはみ出さないようにレイヤーを分けている)
def draw_bust(image, bust_layer):
    pdb.gimp_image_set_active_layer(image, bust_layer)
    set_line_width(6)
    set_color(240, 221, 195, 1.0)
    # 首左下から右胸塗り
    points10 = [
        (376, 500,  0, 0,  0, 0),
        (424, 500,  -1, -5,  +10, +20),
        #(475, 516,  0, 0,  0, 0),
        (475, 520,  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),
        (325, 520,  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)
    # 不透明部分を選択する
    pdb.gimp_image_select_item(image, 0, bust_layer)
    # 選択範囲からマスクを作成する
    mask = pdb.gimp_layer_create_mask(bust_layer, ADD_SELECTION_MASK)
    # マスクをレイヤーに追加する
    pdb.gimp_layer_add_mask(bust_layer, mask)
    # マスク編集を無効にする(マスクでない部分を編集する)
    pdb.gimp_layer_set_edit_mask(bust_layer, FALSE)
    set_color(247, 195, 156, 1.0)
    # 胸影右
    points10 = [
        (538, 680, 0, 0, 0, -30),
        (468, 624, +30, 0, -30, 0),
        (400, 680, 0, -30, 0, 0),
        ]
    make_path_relative(image, points10, 3, TRUE)
    # 胸影左
    points11 = [
        (262, 680, 0, 0, 0, -30),
        (332, 624, -30, 0, +30, 0),
        (400, 680, 0, -30, 0, 0),
        ]
    make_path_relative(image, points11, 3, TRUE)
    # マスクをレイヤーから削除する
    pdb.gimp_layer_remove_mask(bust_layer, MASK_APPLY)
    #
    set_color(0, 0, 0, 1.0)
    # 右胸
    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)
    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)

# 首の影を描画
def draw_body_neck_shadow(image, body_layer):
    pdb.gimp_image_set_active_layer(image, body_layer)
    set_line_width(6)
    set_color(247, 195, 156, 1.0)
    # 首塗り
    points10 = [
        (425, 491,  0, 0, 0, 0),
        (424, 500,  0, 0, +3, +35),
        (376, 500,  0, 0, 0, 0),
        (375, 491,  0, 0, 0, 0),
        ]
    make_path_relative(image, points10, 3, TRUE)

# 顔を描画
def draw_face(image, face_layer):
    pdb.gimp_image_set_active_layer(image, face_layer)
    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)
    # 髪(右内側)3塗りつぶし ハイライトと重なる部分を透明にしないために塗る
    points14_3 = [
	(489, 316),
	(503, 343),
	(503, 360),
	(460, 360),
	(460, 316),
        ]
    make_path_relative(image, points14_3, 3, TRUE)
    # 髪(左内側)3塗りつぶし ハイライトと重なる部分を透明にしないために塗る
    points15_3 = [
	(311, 316),
	(297, 343),
	(297, 360),
	(340, 360),
	(340, 316),
        ]
    make_path_relative(image, points15_3, 3, TRUE)
    #
    # 不透明部分を選択する
    pdb.gimp_image_select_item(image, 0, bangs_layer)
    # 選択範囲からマスクを作成する
    mask = pdb.gimp_layer_create_mask(bangs_layer, ADD_SELECTION_MASK)
    # マスクをレイヤーに追加する
    pdb.gimp_layer_add_mask(bangs_layer, mask)
    # マスク編集を無効にする(マスクでない部分を編集する)
    pdb.gimp_layer_set_edit_mask(bangs_layer, FALSE)
    set_color(204, 146, 117, 1.0)
    # 髪ハイライト右
    points1 = [
	(500, 320, 0, 0, -30, +30),
	(400, 345, +20, -3, 0, 0),
	(400, 355, 0, 0, +30, -3),
	(500, 330, -10, +30, 0, 0),
        ]
    make_path_relative(image, points1, 3, TRUE)
    # 髪ハイライト左
    points1 = [
	(300, 320, 0, 0, +30, +30),
	(400, 345, -20, -3, 0, 0),
	(400, 355, 0, 0, -30, -3),
	(300, 330, +10, +30, 0, 0),
        ]
    make_path_relative(image, points1, 3, TRUE)
    # マスクをレイヤーから削除する
    pdb.gimp_layer_remove_mask(bangs_layer, MASK_APPLY)
    #
    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_waist(image, swimsuit_waist_layer):
    pdb.gimp_image_set_active_layer(image, swimsuit_waist_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(16, 39, 75, 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(16, 39, 75, 1.0)
    make_path_relative(image, points11, 3, TRUE)
    set_color(0, 0, 0, 1.0)
    make_path_relative(image, points11, 1, TRUE)
    set_color(29, 49, 86, 1.0)
    # 胸真ん中少し上、ウエスト右から股右塗り
    points10 = [
        (400, 630,  0, 0,  0, 0),

        (484, 676,  0, 0,  0, 0),
        #(470, 740,  0, -30,  0, +30),
        (471, 740,  0, -30,  0, +30),
        #(496, 796,  -10, -10,  0, +20),
        (496, 794,  -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),
        (329, 740,  0, -30,  0, +30),
        #(304, 796,  +10, -10,  0, +20),
        (304, 794,  +10, -10,  0, +20),

        (360, 880,  0, 0,  +15, +15),
        (400, 900,  -10, 0,  0, 0),
        ]
    make_path_relative(image, points11, 3, TRUE)
    set_color(16, 39, 75, 1.0)
    # ウエスト右影
    points10 = [
        #(400, 630,  0, 0,  0, 0),

        (484, 676,  0, 0,  0, 0),
        #(470, 740,  0, -30,  0, +30),
        (471, 740,  0, -30,  0, +30),
        #(496, 796,  -10, -10,  0, +20),
        #(496, 794,  -10, -10,  0, +20),
        (496, 794,  -10, -10,  0, 0),

        (488, 813,  0, 0,  0, 0),
        (458, 740,  0, +30,  0, -30),
        (475, 676,  0, 0,  0, 0),
        ]
    make_path_relative(image, points10, 3, TRUE)
    set_color(51, 69, 108, 1.0)
    # ウエスト左光
    points11 = [
        #(400, 630,  0, 0,  0, 0),

        (316, 676,  0, 0,  0, 0),
        #(330, 740,  0, -30,  0, +30),
        (329, 740,  0, -30,  0, +30),
        #(304, 796,  +10, -10,  0, +20),
        #(304, 794,  +10, -10,  0, +20),
        (304, 794,  +10, -10,  0, 0),

        (312, 813,  0, 0,  0, 0),
        (342, 740,  0, +30,  0, -30),
        (325, 676,  0, 0,  0, 0),
        ]
    make_path_relative(image, points11, 3, TRUE)
    set_color(0, 0, 0, 1.0)
    # 胸真ん中少し上、ウエスト右から股右外側線
    points10 = [
        (400, 630,  0, 0,  0, 0),

        (484, 676,  0, 0,  0, 0),
        #(470, 740,  0, -30,  0, +30),
        (471, 740,  0, -30,  0, +30),
        #(496, 796,  -10, -10,  0, +20),
        (496, 794,  -10, -10,  0, +20),

        (440, 880,  0, 0,  -15, +15),
        (400, 900,  +10, 0,  0, 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),
        (329, 740,  0, -30,  0, +30),
        #(304, 796,  +10, -10,  0, +20),
        (304, 794,  +10, -10,  0, +20),

        (360, 880,  0, 0,  +15, +15),
        (400, 900,  -10, 0,  0, 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)

# 水着バストを描画(胸の影がはみ出さないようにレイヤーを分けている)
def draw_swimsuit_bust(image, swimsuit_bust_layer):
    pdb.gimp_image_set_active_layer(image, swimsuit_bust_layer)
    set_line_width(3)
    set_color(29, 49, 86, 1.0)
    # 右胸塗り
    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),
        ]
    make_path_relative(image, points10, 3, 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)
    #
    # 不透明部分を選択する
    pdb.gimp_image_select_item(image, 0, swimsuit_bust_layer)
    # 選択範囲からマスクを作成する
    mask = pdb.gimp_layer_create_mask(swimsuit_bust_layer, ADD_SELECTION_MASK)
    # マスクをレイヤーに追加する
    pdb.gimp_layer_add_mask(swimsuit_bust_layer, mask)
    # マスク編集を無効にする(マスクでない部分を編集する)
    pdb.gimp_layer_set_edit_mask(swimsuit_bust_layer, FALSE)
    set_color(16, 39, 75, 1.0)
    # 胸影右
    points10 = [
        (538, 680, 0, 0, 0, -30),
        (468, 624, +30, 0, -30, 0),
        (400, 680, 0, -30, 0, 0),
        ]
    make_path_relative(image, points10, 3, TRUE)
    # 胸影左
    points11 = [
        (262, 680, 0, 0, 0, -30),
        (332, 624, -30, 0, +30, 0),
        (400, 680, 0, -30, 0, 0),
        ]
    make_path_relative(image, points11, 3, TRUE)
    set_color(182, 197, 245, 1.0)
    # ブラシ「2. Hardness 050」(51x51)を選択
    pdb.gimp_context_set_brush("2. Hardness 050")
    # 胸ハイライト右
    points10 = [
        (440, 600, 0, 0, 0, 0),
        ]
    make_path_relative(image, points10, 2, TRUE)
    # 胸ハイライト左
    points11 = [
        (312, 600, 0, 0, 0, 0),
        ]
    make_path_relative(image, points11, 2, TRUE)
    # ブラシ「1. Pixel」(3x3)を選択
    pdb.gimp_context_set_brush("1. Pixel")
    # マスクをレイヤーから削除する
    pdb.gimp_layer_remove_mask(swimsuit_bust_layer, MASK_APPLY)
    #
    set_color(0, 0, 0, 1.0)
    # 右胸外側線
    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),
        ]
    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),
        ]
    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():
    # ブラシ「1. Pixel」(3x3)を選択。「ブラシで描画」に切り替えることはできないので事前に変更して下さい。
    pdb.gimp_context_set_brush("1. Pixel")
    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, "補助線")
    body_layer_group = add_layer_group(image, "体グループ")
    back_hair_layer = add_child_layer_transparent(image, body_layer_group, "後髪")
    body_layer = add_child_layer_transparent(image, body_layer_group, "")
    bust_layer = add_child_layer_transparent(image, body_layer_group, "")
    face_layer = add_child_layer_transparent(image, body_layer_group, "")
    eyes_layer = add_child_layer_transparent(image, body_layer_group, "")
    bangs_layer = add_child_layer_transparent(image, body_layer_group, "前髪")
    swimsuit_layer_group = add_layer_group(image, "水着グループ")
    swimsuit_waist_layer = add_child_layer_transparent(image, swimsuit_layer_group, "水着ウエスト")
    swimsuit_bust_layer = add_child_layer_transparent(image, swimsuit_layer_group, "水着バスト")
    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_bust(image, bust_layer)
    # 胸レイヤーをすぐ下の体レイヤーと統合する
    new_body_layer = pdb.gimp_image_merge_down(image, bust_layer, EXPAND_AS_NECESSARY)
    # レイヤー統合した後に首の影を描画する
    draw_body_neck_shadow(image, new_body_layer)
    draw_face(image, face_layer)
    draw_bangs(image, bangs_layer)
    draw_swimsuit_waist(image, swimsuit_waist_layer)
    draw_swimsuit_bust(image, swimsuit_bust_layer)
    #
    display_image(image)

main()

#5.スクリプト実行方法

5 分で始める GIMP Python-Fu - Qiitaと同じ方法で実行して下さい。

#6.参考

gimp - GIMP Python-fuネストされたグループレイヤー - 答えた

#7.その他

水着を追加しました。
GIMP Python-Fuでイラストを描く その5 水着追加編 - Qiita

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?