|
|
|
@ -27,6 +27,7 @@ public class JmText2Image extends JmCommon {
|
|
|
|
|
req.put("prompt", prompt);
|
|
|
|
|
String responseBody = doRequest("POST", new HashMap<>(), req.toString().getBytes(), action);
|
|
|
|
|
JSONObject jo = JSON.parseObject(responseBody);
|
|
|
|
|
log.info(jo.toString());
|
|
|
|
|
String imgBase64 = jo.getJSONObject("data").getJSONArray("binary_data_base64").getFirst().toString();
|
|
|
|
|
// 对 Base64 字符串进行解码
|
|
|
|
|
Base64.Decoder decoder = Base64.getDecoder();
|
|
|
|
@ -42,8 +43,9 @@ public class JmText2Image extends JmCommon {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
|
String prompt = "制作一张vlog视频封面。马卡龙配色,美女旅游照片+色块的拼贴画风格,主文案是“威海旅游vlog”,副文案是“特种兵一日游 被低估的旅游城市”,海报主体是一个穿着短裙、梳双马尾的少女,人物白色描边";
|
|
|
|
|
String saveImagePath = "d:/Temp/1.jpg";
|
|
|
|
|
//String prompt = "制作一张vlog视频封面。马卡龙配色,美女旅游照片+色块的拼贴画风格,主文案是“威海旅游vlog”,副文案是“特种兵一日游 被低估的旅游城市”,海报主体是一个穿着短裙、梳双马尾的少女,人物白色描边";
|
|
|
|
|
String prompt="过曝,强对比,夜晚,雪地里,巨大的黄色浴缸,小狗泡澡带墨镜,在喝红酒,胶片摄影,毛刺质感,复古滤镜,夜晚,过度曝光,古早,70年代摄影,复古老照片,闪光灯拍摄,闪光灯效果,过曝,过度曝光,闪光灯过曝,极简,高饱和复古色,70s vintage photography, vintage, retro style";
|
|
|
|
|
String saveImagePath = "d:/Temp/2.jpg";
|
|
|
|
|
JmText2Image.generateImage(prompt, saveImagePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|