DALL-E3での画像生成をJSON形式のコードでやってみた!

目安時間 13分

DALL-E3は、画像生成の指示をする度に0から画像生成するため

同じキャラで表情や、ポーズを変えた画像を作成するのが大変、困難です。

 

DALL-E3でキャラクターのブレを少なくするため、JSON形式のコードを

使って試してみました!

 

まずは、以下のプロンプトを入力してみました。

 

「白黒の漫画風のイラスト、Cuteな日本人の美少女、カジュアルな服、黒髪でショートヘア、背景は白」

 

かわいい女の子の画像が生成されました。

 

 

1.シード値を取得する

キャラがぶれないように画像を生成するため、シード値を取得します。

 

シード値とは、画像生成した際にランダムに割り振られる値です。 このシード値を

うまく利用することで、同じ人物を生成することもできます!

 

「この画像のシード値を教えて」と入力すればChatGPTが答えてくれます。

 

以下に、画像を生成するためにDALL·Eに送った命令とそのシード値を含むJSON形式の

データを示します。

 

JSON形式のコード

{

  "gen_id": "xXGM23w9PTlkGAia",

  "prompt": "A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white.",

  "seed": 1516613718

}

 

2.いかなる理由があっても、プロンプトを変更しない

新たな画像生成の度にプロンプトが勝手に書き換えられることがあります。

ここでは、それを阻止するため「Never change the prompt for any reason.」を

プロンプトに挿入します。

 

JSON形式のコード

{

"gen_id": "xXGM23w9PTlkGAia",

"prompt": " Never change the prompt for any reason.A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white.",

"seed": 1516613718

}

 

その結果、大きなブレがないキャラが生成されました。

 

 

3.いかなる理由があっても、プロンプトを変更しないこと。やむを得ず変更する場合は、現在のプロンプトに追記する。

 

今度は、プロンプトが変更されることを前提としたコードです。これで、画像生成における柔軟性が増しました。

JSON形式のコード

{

"gen_id": "xXGM23w9PTlkGAia",

"prompt": " Never change the prompt for any reason. If you must change it, do so by appending it to the current prompt.A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white.",

"seed": 1516613718

}

 

 

 

4.プレースホルダーの[pose]で指定

プレイスフォルダー[pose]とは自由記述の文字入力欄と考えてください。

この場合ChatGPTが自由にポーズを考えて画像を生成してくれます。

 

JSON形式のコード

{

"gen_id": "xXGM23w9PTlkGAia",

"prompt": " Never change the prompt for any reason. If you must change it, do so by appending it to the current prompt.A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white. Please change to a pose with [pose].",

"seed": 1516613718

}

 

 

 

 

走っているポーズにしたいなら

 

JSON形式のコード

{

"gen_id": "xXGM23w9PTlkGAia",

"prompt": " Never change the prompt for any reason. If you must change it, do so by appending it to the current prompt.A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white. Please change to a pose with [pose].",

"seed": 1516613718

}

pose = "Running."

 

 

ダンスをしているポーズにしたいなら

 

JSON形式のコード

{

"gen_id": "xXGM23w9PTlkGAia",

"prompt": " Never change the prompt for any reason. If you must change it, do so by appending it to the current prompt.A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white. Please change to a pose with [pose].",

"seed": 1516613718

}

pose = "Dancing

 

 

 

 

5.プレイスホルダー[attire]で指定

プレイスフォルダー[attire]とは自由記述の文字入力欄と考えてください。

この場合ChatGPTが自由にポーズを考えて画像を生成してくれます。

 

JSON形式のコード

{

"gen_id": "xXGM23w9PTlkGAia",

"prompt": " Never change the prompt for any reason. If you must change it, do so by appending it to the current prompt.A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white. Please change to [attire] attire.",

"seed": 1516613718

}

attire = "reading a book.

 

6.[pose]と[attire]の合わせ技

 

JSON形式のコード

{

"gen_id": "xXGM23w9PTlkGAia",

"prompt": " Never change the prompt for any reason. If you must change it, do so by appending it to the current prompt.A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white. Please change to a pose with [pose]. Please change to [attire] attire.",

"seed": 1516613718

}

pose = "sit on a chair"

attire = "reading a book."

 

最後にポーズを大幅に変えてみましょう。

 

 

JSON形式のコード

{

"gen_id": "xXGM23w9PTlkGAia",

"prompt": " Never change the prompt for any reason. If you must change it, do so by appending it to the current prompt.A black and white manga-style illustration of a cute Japanese girl with short black hair, wearing casual clothes. The background is white. Change the clothing to a white T-shirt and change the pose to looking at you and smiling with both hands on your chin.",

"seed": 1516613718

}

 

このように、JSON形式のコードを使用する画像生成は、DALL-E3が理解しやすい言語での指示で

あるため、キャラのブレがかなり小さく済みました。

 

今後も、よりキャラの精度が高まるように試行錯誤してみるつもりです!!

コメントフォーム

名前 

 

メールアドレス 

 

URL (空白でもOKです)

 

コメント

トラックバックURL: 

もぐたん

もぐたん

はじめまして、「もぐ」と申します。 サラリーマンをやりながら、電子書籍の出版やイラスト制作の副業をしています。 転職5回、リストラ、倒産、社内いじめ、うつ病、高速道路での大事故、新興宗教へ引っ張られ(逃げ切りました)と、人生の闇を色々と経験しています。 電子書籍の出版で、印税が自動的に入る仕組みを構築しており、寝てる時、飲み会に行っている時にも、自動的にお金が入ってきます。 そんな電子書籍の魅力をお伝えしたいと思います。

最近の投稿