Press "Enter" to skip to content

JS Tech Road

AI prompt [繪畫風格篇]

1. Impasto Technique (厚塗法): 建構大面積的厚重顏料,以突顯質感。

2. Sgraffito (刮蝕法): 利用刀具在上層塗層中刮除以顯露下方顏色或材質。

3. Pointillism (點彩法): 以小點狀顏料堆疊,透過視覺混合產生色彩變化。

4. Chiaroscuro (明暗對比法): 透過強烈的光影對比,營造出深度感。

5. Tenebrism (明暗法): 強調高對比的明暗效果,特別是在暗部的強烈照明。

6. Glazing (透明層法): 透明色彩層的疊加,創造出柔和的色調過渡。

7. Scumbling (抹除法): 輕輕抹掉部分畫層,營造模糊或透明的效果。

8. Spray Paint Art (噴漆藝術): 利用噴漆技巧創作具有分層感的畫作。

9. Encaustic Painting (熱蠟畫法): 使用融化的蠟塗抹,創造出質感豐富的表面。

10. Stippling (點描法): 利用小點狀筆觸繪畫,形成細緻的紋理和陰影。

11. Cubism (立體主義): 將物體拆解為多個幾何形狀,再重新組合呈現。

12. Fauvism (野獸派): 強調生動色彩和放縱筆觸,表現出抽象而夢幻的感覺。

13. Trompe-l’oeil (視覺欺騙法): 透過超逼真繪畫創造出真實物體的錯覺。

14. Grisaille (灰調畫法): 使用單一色調(通常是灰色)創作畫作,突顯光影效果。

15. Collage (拼貼畫法): 利用剪貼的方式,將不同材料拼貼在畫布上。

16. Surrealism (超現實主義): 呈現超現實或夢幻的場景,挑戰現實規律。

17. Kinetic Art (動態藝術): 創作中蘊含運動或變動的元素,使畫面有生命力。

18. Photorealism (照片寫實主義): 追求極致真實感,仿照照片細緻繪製。

19. Abstract Expressionism (抽象表現主義): 強調表情和筆觸的自由表達,抽象而富有情感。

20. Op Art (光學藝術): 透過視覺效果和錯覺,引導觀眾產生視覺上的變化。

1. Chiaroscuro (明暗對比): 利用強烈的光影對比,產生深邃的明暗效果,營造戲劇性的視覺效果。

2. Sfumato (煙霧柔化): 通過色彩和光影的柔和過渡,創造出細緻、柔和的畫面,常見於達文西的作品。

3. Pointillism (點彩主義): 以小點描繪畫面,觀眾的視覺距離遠時,這些小點合而為一,形成豐富的色彩和紋理。

4. Tenebrism (強光對比): 突顯強烈的光影對比,使畫面中的主題更加突出,產生強烈的視覺效果。

5. Negative Space (負空間): 利用畫面中的空白區域,強化畫面中的主題,形成平衡和對比。

6. Pop Art (波普藝術): 強調大眾文化和消費品,運用鮮豔的色彩和平面設計,突顯生活中的日常物品。

7. Cubism (立體主義): 將物體拆解為多個平面和角度,同時呈現在一幅畫中,表現對立面的立體感。

8. Impasto (厚塗): 在畫布上厚厚地塗抹顏料,形成凸起的質感,突顯畫家的筆觸和繪畫過程。

9. Trompe-l’oeil (畫中畫): 透過逼真的繪畫技巧,創造出三維的視覺錯覺,讓觀眾產生真實存在的感覺。

10. Graffiti Art (塗鴉藝術): 在公共空間以塗鴉的方式表現藝術,強調個性和街頭文化。

11. Hatching and Cross-Hatching (素描線條): 利用平行的線條交叉疊加,產生陰影和細節,常見於素描和鉛筆畫。

12. Collage (拼貼): 將不同的材料或圖片拼貼在一起,創造出多元的視覺效果。

13. Monochromatic Color Scheme (單色調): 使用相同色系的不同色調,突顯單一色彩的豐富層次。

14. Geometric Abstraction (幾何抽象): 以幾何形狀和線條為主,創造出抽象的藝術作品。

15. Splash and Splatter (濺彩): 通過濺濕或濺擦筆刷,創造出隨機的彩濛效果,充滿動感和活力。

16. Realism (寫實主義): 追求畫面的真實和細緻,以細緻的筆觸呈現物體的真實樣貌。

17. Abstract Expressionism (抽象表現主義): 藉由抽象的形式和豐富的筆觸,表達藝術家的情感和抽象的思維。

18. Zen Painting (禪宗畫): 融合禪宗哲學,追求簡樸、寧靜、和諧的畫風。

19. Stippling (點描): 利用細小的點

20. Ephemeral Art (短暫藝術): 以易褪色或易變形的材料和媒介,強調藝術的短暫性和變動性。

21. Arabic miniature on plain paper(伊斯蘭教細密畫):極細的筆觸,裝飾性元素

1. Glaze (釉彩): 在畫布上透明的塗層,營造出柔和、光滑的表面效果。

2. Wash (水彩擴散): 將彩料稀釋後均勻塗抹,產生透明且柔和的色彩過渡。

3. Dry Brush (乾刷): 使用少量彩料,刷去多餘水分,產生粗糙的筆觸和質感。

4. Wet-on-Wet (濕拓擴散): 在濕潤的畫布上塗抹彩料,使色彩自然交融。

5. Gradients (漸層): 將相似色調的彩料混合,呈現平滑的漸變效果。

6. Sgraffito (削刻): 在彩層未乾前,用尖物削刮表面,露出底層顏色。

7. Impasto (厚塗): 建構厚實的彩料,增加立體感和質感。

8. Pointillism (點彩): 以小點狀彩點構成圖像,透過視覺混合形成色彩變化。

9. Masking Fluid (遮罩液): 使用膠狀物質遮蓋部分區域,保留白色或底層顏色。

10. Negative Painting (負片塗色): 繪製周圍區域,使主題浮現於底色之間。

11. Palette Knife (調色刀): 利用平板刀具塑造立體感和紋理效果。

12. Resist Technique (抵抗法): 使用蠟、油漆或膠水在畫布上形成障礙,不讓某些區域沾染色彩。

13. Spatter (飛濺): 將濕潤的筆刷拍打或劃過,創造出細小飛濺的效果。

14. Graffiti Style (塗鴉風格): 模仿街頭藝術,強調文字、圖案和生動色彩。

15. Scumbling (抹除): 輕輕抹除部分彩層,營造柔和或透明的效果。

16. Glitter and Metallics (閃粉和金屬感): 添加閃粉或金屬粉末,增添光澤和質感。

17. Wax Resist (蠟抵抗): 利用蠟或蠟筆在畫布上形成障礙,不讓染色液體滲透。

18. Collage (拼貼): 將其他素材如紙張、布料黏貼在畫布上,創造出多元材質效果。

19. Digital Brushes (數位筆刷): 利用數位軟體的特殊筆刷,創造出多樣效果。

20. Monoprinting (單色印刷): 在平滑表面上製作一次性的印刷,產生獨特效果。

1. Scratchboard Art (刮刻板畫): 使用專用的板材,透過刮除表面黑層呈現白色線條,獨特的反轉繪畫方式。

2. Pyrography (木燒畫): 利用加熱金屬尖頭,將圖案燒刻在木板或皮革上,展現木紋和灼痕效果。

3. Gyotaku (魚拓): 將魚身塗墨後,將紙壓在其表面,呈現逼真的魚紋和鱗片,源自日本的傳統藝術。

4. Engraving (鐫刻): 利用刀具在平面表面切割或刻印,形成精細的線條和圖案。

5. Smoke Art (煙霧畫): 利用煙霧的流動和沉降,將畫布置於煙霧中,創造出抽象而有層次感的效果。

6. Altered Books Art (書本改造藝術): 將舊書本改編成藝術品,透過剪貼、繪畫和雕刻,賦予書本新的生命。

7. Anamorphic Art (變形藝術): 在平面上繪製具有變形視覺效果的圖案,需透過特定角度或工具觀看才能看清。

8. Quilling (紙條藝術): 利用捲曲紙條黏貼成各種形狀,呈現出獨特的紋理和層次。

9. Sand Painting (沙畫): 在平面上灑擲或粘貼不同顏色的沙粒,形成富有質感和層次感的圖案。

10. Zentangle (禪繞畫): 以結構化的圖案和線條填充區域,強調藝術的冥想和放鬆效果。

11. Thread Art (線繪藝術): 利用線材在布上繪製圖案,通常搭配刺繡或織布技法。

12. Digital Doodling (數位塗鴉): 利用數位繪圖板或手繪板,隨心所欲地進行創作,具有即時性和可修改性。

13. Marbling Art (大理石紋藝術): 在水上滴墨或倒墨,再將紙張放置其表面,形成迷人的大理石紋路。

14. Colored Pencil Sculpture (彩色鉛筆雕塑): 利用削成的彩色鉛筆塑造出精細的雕塑作品,結合藝術和手工技藝。

15. Stained Glass Painting (玻璃彩繪): 在透明玻璃上使用顏料繪製圖案,透過光線呈現色彩斑斕的效果。

16. Toyism (玩具主義): 以豐富色彩和夢幻風格呈現出充滿童趣和奇幻的畫面。

17. Plasticine Art (橡皮泥藝術): 以橡皮泥塑造出各種形狀和細節,創作出具有立體感的藝術品。

18. Coffee Painting (咖啡畫): 使用咖啡取代傳統顏料進行繪畫,呈現出獨特的茶質感和色澤。

19. Light Painting (光繪): 利用長時間曝光和光源,繪製出光影效果,常用於夜間創作。

20. Cross-Hatching (交叉素描): 以平行且交叉的線條營造陰影和細節,常見於素描和壁畫。

21. Sgraffito (刮蝕法): 利用刀具在上層塗層中刮除以顯露下方顏色或材質,增添畫面層次感。

22. Glass Engraving (玻璃雕刻): 在玻璃表面進行雕刻,呈現出細緻而逼真的圖案,常見於裝飾品或藝術品。

23. Eggshell Mosaic (蛋殼馬賽克): 利用彩繪或拼貼蛋殼片段,創作出富有質感和紋理的藝術品。

24. Smoke Art (煙霧畫): 利用煙霧的流動和沉降,在畫布上形成抽象且迷人的效果。

25. Fire Painting (火焰畫): 利用火焰或火燄進行繪畫,創造出獨特的燃燒藝術效果。

26. Yarn Bombing (羊毛炸彈): 以彩色羊毛編織或纏繞物體,為城市景觀增添藝術氛圍。

27. Plastic Bag Art (塑膠袋藝術): 利用塑膠袋創作藝術品,探討可回收和可持續性的主題。

28. Digital Collage (數位拼貼): 利用電腦軟體製作拼貼效果,將不同素材結合成為一幅藝術品。

29. Shadow Art (影子藝術): 利用光影和物體形狀,創作出在平面上呈現逼真陰影的藝術品。

30. Recycled Art (回收藝術): 利用回收材料製作藝術品,強調可持續發展和環保觀念。

31. Leaf Carving (葉片雕刻): 在植物葉片上進行微細雕刻,呈現出栩栩如生的藝術作品。

32. Digital Spray Painting (數位噴漆): 利用數位軟體模擬噴漆效果,進行藝術創作。

33. Melted Crayon Art (蠟筆熔融畫): 利用蠟筆融化的特性,創作出獨特的色彩流動效果。

34. Ice Sculpture Painting (冰雕繪畫): 在冰雕表面進行繪畫,融合立體雕塑和繪畫元素。

35. Fruit and Vegetable Carving (水果蔬菜雕刻): 利用水果和蔬菜進行雕刻,營造出食物藝術品。

36. Sand Animation (沙畫動畫): 利用沙子在透明表面上繪製動畫,展現出奇妙的沙畫效果。

37. Sound Wave Art (聲波藝術): 將聲音波形轉換為視覺藝術,呈現出獨特的音樂視覺化效果。

38. Recycled Circuit Board Art (電路板藝術): 利用廢棄的電路板創作出抽象且科技感的藝術品。

39. Glitter Painting (亮片繪畫): 在畫作上添加亮片,營造出閃亮奪目的視覺效果。

40. Digital Light Painting (數位光繪): 利用光源在數位畫布上進行繪畫,產生動態光影效果。

(我不懂這麼多,這些都是AI與google告訴我的~)

還請專業前輩們指教補充與糾正! 感謝~!

(转载) Stable Diffusion绘画创意文字实操教程

AIGC技术不断更新迭代,国内出现了越来越多的新玩法,比如最近大家都在热议的AI绘画创意文字。

过去的一周,我把这些新玩法都研究了一遍,并总结了一套完整的制作流程。

主流的创意文字玩法主要分为四类:

  1. 光影文字
  2. 嵌入文字
  3. 隐藏文字
  4. 海报文字

每种类型的文字制作流程大致都是这四步

制作文字底图

选取大模型

写关键词(Prompt)

ControlNet参数设置

核心:文生图+文字底图(ControlNet)

本教程用到的所有资料,我都已经整理好放在文章末尾的网盘链接里,你不需要花费很多时间和精力去寻找了。

我在整理这些内容上花了很多时间,希望它们能对你有所帮助。

下面直奔主题:

通用部分实操

制作文字底图

美图秀秀,PS都可以,我这里使用的是不专业的美图秀秀

海报文字、嵌入文字用白底黑字

隐藏文字、光影文字用黑底白字

打开美图秀秀=》图片美化=》制作壁纸=》选择背景颜色=》下一步(进行文字编辑,不过多介绍)

选取大模型:

真人图片就用: majicmixRealistic,chilloutmix

其他用: revAnimated,realisticVision,deliberate

本文中所用到的所有模型资料,都会给大家打包整理好,放在文末的网盘链接里

有精力和时间的,大家可以多尝试,或许会抽到意想不到的效果。

1.光影文字实操:

1.1 制作底图(黑底白字):

这个图好像有点吓人

1.2 选取大模型:

选真实感大模型(majicRealistic或者chilloutmix)

1.3 写关键词(Prompt):

城市建筑通用词:

Best quality, ultra high definition, masterpiece, ultimate details, 8K,

Urban night view, buildings, cars, headlights, streets, roads, water reflection

最好的质量,超高清,杰作,极致细节,8K,

城市夜景,建筑,汽车,前灯,街道,道路,水反射

人物通用词:

The highest quality, masterpiece, ultimate detail,

1 girl, beautiful, full body, long skirt, standing with hands in pockets

最高的质量,杰作,极致细节,

1个女孩,漂亮,全身,长裙,站着,双手插在口袋里

StableDiffusion的关键词分类查询

①先写画面质量

②然后写小姐姐的外型描述

③最好加上一些“阳光”、“光和阴影”、“明暗对比”之类的词,并且加一点权重

sunlight, light and shadow, chiaroscuro

正面关键词:

((masterpiece)),(highres:1.3), (((best quality))), ((ultra-detailed)), ((illustration)),(photorealistic:1.3),(realistic:1.4),(Cinematic Lighting:1.3),

aynamic angle,in the winter,(snow white forest:1.1), hazy mist,,(on the hot springs:1.3) ,(many thin detailed snowflakes:1.3), (bloom), (shine), (twinkling stars:), (snowing), many white tree, detailed snowflakes,

cowboy shot,

(1 girl),(((solo))),running,(between legs:1.3),

(chinese girl:1.1),

hanfu,hanfugirl, beautiful detailed eyes,(black eyes:1.2),,(pale firered hair:1.3),light smile,

(big breasts:1.1),

,(beautiful detailed face:1.3),(cute), blushing,, light smile, makeup ,lipstick,detailed clothes,,(pale red transparent tight floral qipao dress:1.35),

(white fishnet thighhighs:1.25).

lora:add_detail:0.5,

sunlight, light and shadow, chiaroscuro

负面关键词:

(cleavage:1.4),(Multiple people),(((simple background))),monochrome ,lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality,

normal quality, jpeg artifacts, signature, watermark, username, blurry, lowres, bad anatomy, bad hands, text, error, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, ugly,pregnant,vore,duplicate,morbid,mut ilated,tran nsexual, hermaphrodite,long neck,mutated hands,poorly drawn hands,poorly drawn face,mutation,deformed,blurry,bad anatomy,bad proportions,malformed limbs,extra limbs,cloned face,disfigured,gross proportions, (((missing arms))),(((missing legs))), (((extra arms))),(((extra legs))),pubic hair, plump,bad legs,error,legs,username,blurry,bad feet ,(cleavage:1.4)

1.4 重要的ControlNet参数设置

我用的是tile模型

需要特别注意的就是控制权重(Control Weight)引导终止时机(Ending Control Step)

控制权重(Control Weight) :设置在0.35~0.55之间

引导终止时机(Ending Control Step) :0.7~1,越接近 1 字越清晰

没有固定的参数,不同的字需要分别调整,只能自己多试试

1.5 最终效果:

2.嵌入文字实操:

2.1 制作底图(白底黑字):

2.2 选取大模型

这里选择的是:deliberate,其他的revAnimated,realisticVision 也可以尝试

2.3 写关键词(Prompt)

梅花、红色、花瓣、冬天、雪白背景、古老树干、明亮蓝天、坚韧、生动、活力

Plum Blossom, Red, Petals, Winter, Snowy Backdrop, Ancient Trunk, Bright Blue Sky, Resilient, Vibrant, Dynamic

正面关键词:

Best quality, ultra high definition, masterpiece, ultimate details, 8K,

Plum Blossom, Red, Petals, Winter, Snowy Backdrop, Ancient Trunk, Bright Blue Sky, Resilient, Vibrant, Dynamic

负面关键词:

我这里找了一个关于景色的负面词:

(normal quality), (low quality), (worst quality), paintings, sketches,fog,signature,soft, blurry,drawing,sketch, poor quality, uply text,type, word, logo, pixelated, low resolution.,saturated,high contrast, oversharpened,dirt,

2.4 重要的ControlNet参数设置

接着就是controlnet的选择,这里就要选 canny,lineart,softedg,scribble 这些线稿的模型

在我实际测试下来,canny和scribble出来的效果都还可以,大家可以优先尝试这两个模型

降低权重,这样文字才能更好和场景融合到一起

可以把权重设置到 0.65~0.85 之间,想要文字更加突出权重就加大

2.5 最终效果

3.隐藏文字实操:

黑底白字

3.1 制作底图(黑底白字):

3.2 选取大模型

我这里选择的realisticVision,其他的也可以尝试:deliberate,revAnimated

3.3 写关键词(Prompt):

关键词: 英文:Oriental Pearl Tower, Dazzling Light, Night Sky, Spherical Structure, Skyline, Skyscrapers, Huangpu River, Bright Pearl, Shanghai.

中文:东方明珠、炫目光芒、夜空、球体结构、天际线、摩天大楼、黄浦江、璀璨明珠、上海。

正面关键词:

Best quality, ultra high definition, masterpiece, ultimate details, 8K,

Urban night view, buildings, cars, headlights, streets, roads, water reflection

Oriental Pearl Tower, Dazzling Light, Night Sky, Spherical Structure, Skyline, Skyscrapers, Huangpu River, Bright Pearl, Shanghai

负面关键词:

(normal quality), (low quality), (worst quality), paintings, sketches,fog,signature,soft, blurry,drawing,sketch, poor quality, uply text,type, word, logo, pixelated, low resolution.,saturated,high contrast, oversharpened,dirt,

3.4 重要的ControlNet参数设置

注意:controlnet的参数设置比较重要

这里我们需要下载一个新的controlnet模型

模型可以在文末的网盘下载

模型存放位置:sd目录 \ models \ ControlNet

不需要预处理器,模型就选我们新下载的

特别要注意的是控制权重,只要在0.45~0.65之间就可以了

控制权重可以多来回试试效果,需要字清晰一点权重就大一点

3.5 最终效果

效果不是太好,可以慢慢的调节参数。

4.海报文字实操:

4.1 制作底图(白底黑字):

4.2 选取大模型

我这里选择的是:revAnimated

4.3 写关键词(Prompt):

描述: 这幅画描绘了一池生机勃勃的荷花。在画面中心,一朵荷花在阳光下展开,粉红色的花瓣像丝绸般光滑,散发着淡淡的清香。绿色的荷叶如伞般展开,浮在宁静的池水上。几只蜻蜓在荷叶间穿梭,增添了一份夏日的热烈。远处,是微风吹动的芦苇和淡蓝色的天空,构成了完美的背景。

关键词: 英文:Lotus, Pink Petals, Sunshine, Green Leaves, Pond, Dragonflies, Reeds, Light Blue Sky, Serene, Summer.

中文:荷花、粉红色花瓣、阳光、绿色荷叶、池塘、蜻蜓、芦苇、淡蓝色天空、宁静、夏日。

正面关键词:

Best quality, ultra high definition, masterpiece, ultimate details, 8K,

Lotus, Pink Petals, Sunshine, Green Leaves, Pond, Dragonflies, Reeds, Light Blue Sky, Serene, Summer,

负面关键词:

我这里依旧使用上面的关键词:

(normal quality), (low quality), (worst quality), paintings, sketches,fog,signature,soft, blurry,drawing,sketch, poor quality, uply text,type, word, logo, pixelated, low resolution.,saturated,high contrast, oversharpened,dirt,

4.4 重要的ControlNet参数设置

预处理器选invert

模型选depth

知识补充

如果是生成液体材质的文字,比如牛奶,可以用canny,lineart,softedg,scribble这几个线稿

然后稍微降低一点controlnet的控制权重(0.6~0.8之间)

这样出来的文字就会有液体飞溅的感觉

4.5 最终效果


Methods for Creating Real AI Portrait from Stable Diffusion (text-to-image face swap)

AI portraits have gained popularity recently, especially with the emergence of a certain phenomenal camera. By simply uploading your photo, you can generate beautiful portrait pictures. This product has once again ignited interest in AI art. Today, I will share a method for creating real AI portraits using the Stable Diffusion WebUI, allowing for quick image generation without the need for training. Specifically, this method involves utilizing the face-swapping capability of Stable Diffusion’s Wensheng Image and the roop plugin.

Please note that this article only shares the technology behind creating AI portraits and does not encourage any malicious use. The author is not responsible for any face-swapping behavior conducted by readers after reading this article.

Installation of Plugins:

Two installation methods are introduced: one through the plugin extension and the other through manual uploading.

After the installation, you will see this option in the text-to-image or image-to-image tab, right below section of the Stable Diffusion WebUI

Method One:

Suitable for users with smooth access to various resources.

  1. Launch Stable Diffusion WebUI and go to “Extension Plugins” > “Install from URL.”
  2. Enter the following URL: github.com/s0md3v/sd-w…
  3. Click “Install.”
  4. Wait for the prompt “Use Installed tab to restart” to appear.
  5. Go to the “Installed” tab and click “Apply and restart the user interface.”


Note: if the webpage still fails to load after restarting for more than 5 minutes, check the console or terminal logs. It might be due to the slow download speed of the models required for the plugin. If the download is taking too long, you can interrupt the download and manually upload these files. For specific instructions on how to do this, refer to Method Two.

Method Two:

Suitable for users with restricted access to Github and HuggingFace.

You will need following files:

  1. Download the necessary files manually from Github and HuggingFace or use the provided compressed package:
  2. Deploy the files to their respective locations on the server/PC(self-host):

copy sd-webui-roop folder to stable-diffusion-webui/extensions/

copy models folder to stable diffusion root directory:

ifnude and insightface folder are a bit tricky; they need to be placed in the user’s root directory, and the folders should be renamed starting with an period.

Taking ifnude as an example,

For Windows: C:\Users{YourLoginUsername}.ifnude

For Linux: /root/.ifnude

For Linux systems, after uploading ifnude and insightface to the root directory, you can quickly rename them using the following command.

mv /root/ifnude /root/.ifnude 

mv /root/insightface /root/.insightface

At the end, restart Stable Diffusion WebUI

Face Swapping:

I will start by using ‘Text to Image’ to generate a photo of a 30-year-old Chinese man. The parameters below are just for your reference; as long as you can generate a portrait image, it’s sufficient. However, if you are new to SD (Stable Diffusion), feel free to follow the settings in the image entirely. Get the initial result and then customize it as needed.

The specific parameters for image generation are as follows:

Checkpoint: realisticVisionV20 (Download link available at the end of the article)

Prompt: ultra quality, masterpiece, best quality, 8k, UHD, a man, Chinese, standing in front of a desk, 30 years old, thin face, long hair, slight smile, (looking at viewer), upper body, solo, portrait photo, with a bookshelf behind, sense of technology, wide shot

Negative Prompt: EasyNegative, bad hands, bad fingers, glasses, worst quality, low quality, normal quality, skin spots, acne, age spots, ugly, deformed

expand roop plug in:

And then upload a new face image with following setting, you test using CodeFormer vs GFPGAN :

Finally click “Generate” button, after few minutes, you should see the result:

For image-to-image face swap:

In image-to-image tab, after upload the photo you want to be swap, then use followin setting:

in roop plugin, upload the new face:

If you only want to replace a specific area on the face, you can also use the inpaint tab, and use your mouse to paint those area. The operation method is shown in the following figure:

After add a mask to the desired facial area, keep other parameters unchanged, and click ‘Generate.’

Done!

Please note that this article only shares the technology behind creating AI portraits and does not encourage any malicious use. The author is not responsible for any face-swapping behavior conducted by readers after reading this article.

Prodia is a tool for generating AI photo stickers online for free, making it easy to create beautiful and personalized pictures

After sharing the teaching of Stable Diffusion to generate realistic human-like pictures before, if you want to simplify the steps, now there is a free Prodia platform, combined with a drawing function similar to Stable Diffusion, you can directly open the web page and generate it with one click, whether it is a mobile phone or a computer. Support, quickly generate personalized photo stickers online through Prodia.

Prodia online AI face painting generator

Prodia is a free AI drawing tool that integrates the Stable Diffusion 1.4 interface and 6 style models. It can also be used with Prompt commands to quickly generate various AI-style photos. It can be used without registration or installing any App program, which is convenient and can be downloaded directly picture.

Although the highest resolution of the free version of Prodia can only produce 512 X 512 pixel AI pictures, it is basically enough to be used as a profile picture or shared on social platforms, unless you want higher quality or excellent pictures, you should consider paying. It is enough to say that most of them are free!

Prodia teaching: Use AI drawing to quickly generate beautiful pictures with one click

After opening the Prodia platform through the browser (link at the end of the article), you will see the upper part similar to the Stable Diffusion setting interface. The first menu on the left can select the model, and the right can enter different commands and values, and finally press “Generate” directly. Immediately produce pictures. If you don’t know how to generate, the fastest way is to directly click the six different sample styles below, including hand-painted, realistic, realistic characters, CG animation style, and electronic drawing.

Prodia teaching: Use AI drawing to quickly generate beautiful pictures with one click

If you want to customize the module and parameter details, you can click the “Control Settings” icon to customize the Prompt, Negative prompt, Smapler, CFG Scale, Steps and Speed ​​values. Usually, you only need to set the module, Prompt, and Negative prompt Three types are fine, and the others do not need to be modified and adjusted. Below are some examples to show you how to use Prodia to generate beautiful AI images.

Prodia teaching: Use AI drawing to quickly generate beautiful pictures with one click 1

SD 1.4 Models: sketch, hand-painted, 3D style

SD 1.4 is more inclined to draw hand-painted and cartoon-type model styles. If you want to produce hand-painted sketch pictures, you can use this model to generate them. However, if you want it to draw a portrait of Luffy, some micro-faces or squinted eyes may appear in the final drawing.

Prodia teaching: Use AI drawing to quickly generate beautiful pictures with one click 2

Anything V3 model: CG style (Japanese)

The Anything V3 model is mainly biased towards Japanese CG character styles. You can try to use the Prompt command below to generate a CG killer-style female appearance.

lucy \(cyberpunk\), 1girl, arm up, asymmetrical hair, belt, bodysuit, covered mouth, covered navel, detached sleeves, grey eyes, hip vent, holding, holding weapon, looking at viewer, night, night sky, pouch, short hair, sky, solo, weapon, white hair, wire, short shorts, shorts, open jacket, <lora:lucy-000035:0.6>
Prodia teaching: Use AI drawing to quickly generate beautiful pictures with one click 3

Anything V4.5 model: CG style (European and American)

Compared with V3, Anything V4.5 also adopts European and American CG styles, but this group of models is more soft and less rigid. You can try to use the commands below to experience the style.

1girl, rogue,hood,(large breasts:1),skindentation, ,black cape , extremely detailed,harness,realistic(masterpiece, best quality:1.2) <lora:animeknight_v2:1>
lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, (worst quality, low quality, normal quality:1.2), jpeg artifacts, signature, watermark, username, blurry, EasyNegative,loli
Prodia teaching: Use AI drawing to quickly generate beautiful pictures with one click 4

Analog V1 Model: Real Life Looks

If you want to generate real-life AI photos, you can directly select the Analog V1 model to generate them. You must use the Prompt command to generate them. For the first time, you can try to use the examples of real-life girls in Examples to generate beautiful pictures of Asian girls. It is also possible. However, the probability of failure is slightly higher. This module is more biased towards Europe and the United States, and Asian female faces are prone to appear.

Prodia teaching: Use AI drawing to quickly generate beautiful pictures with one click 5

TheAlly’s Mix II Digital Portrait (Soft)

If you want to generate 3D electric-style character pictures, you can use TheAlly’s Mix II module, which will be more suitable. You can try it yourself by attaching the prompt command below.

(extremely detailed 8k ), (masterpiece), (best quality), (ultra-detailed), (best illustration), (best shadow), (photorealistic:1.4),(PureErosFace_V1:0.5),real human skin, lens flare, shade, backlighting, depth of field, natural lighting, hard focus, film grain, in front 1 girl, 21 yo, solo, skinny, (oversized clothes, t shirt:1.4), no panties, pale skin, soft lips, (light eyebrow:1.4), brown eyes, black very long straight hair, (small breasts), in classroom(crowd:1.2), aliga, a woman, , <lora:aliga_v1:0.8>
(worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, (outdoor:1.6), manboobs, backlight,(ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.331), blurry, (bad anatomy:1.21), (bad proportions:1.331), extra limbs, (disfigured:1.331), (more than 2 nipples:1.331), (missing arms:1.331), (extra legs:1.331), (fused fingers:1.61051), (too many fingers:1.61051), (unclear eyes:1.331), bad hands, missing fingers, extra digit, (futa:1.1), bad body, NG_DeepNegative_V1_75T,pubic hair, glans
Prodia teaching: Use AI drawing to quickly generate beautiful pictures with one click 6

The bottom is an elf-style female style picture, and each produced work will present a very beautiful effect.

<(masterpiece, realistic:1.3), (extremely intricate:1.2)>, portrait of a girl, face, close up, pointy ears, dress, half-closed eyes, jewelry, sitting, strapless, strapless dress, breasts, watermark, bare shoulders, tiara, grey dress, cleavage, long hair, braid, grey hair, long eyelashes, solo, profile, solo, elf,
(worst quality, low quality:1.4), (depth of field, blurry:1.2), (greyscale, monochrome:1.1), 3D face, cropped, lowres, text, jpeg artifacts, signature, watermark, username, blurry, artist name, trademark, watermark, title, multiple view, Reference sheet, curvy, plump, fat, muscular female, strabismus,
prodia theallys mix ii a

Elldreth’s Vivid model: video game CG style portrait (shadow)

The last group of Elldreth’s Vivid models are more Korean video game CG style, with more obvious shadow effects, and the picture is closer to electronic drawing. As for the example, you can continue to use the above elf female style code.

Prodia Teaching: Use AI drawing to quickly generate beautiful pictures with one click 7

How to quickly apply Prodia commands?

After reading this Prodia tutorial, you will definitely want to produce other real-life photos with different styles. It is recommended to refer to the Civitai website. Most of the above pictures are produced using Stable Diffusion, and you can find what you want from there. Prodia photo style.

How to quickly apply Stable Diffusion works and image data?

After choosing the picture style you like, there will also be Prompt and Negative prompt descriptions inside, just paste these two descriptions on the Prodia platform.

stable diffusion google colab 19 1

function summary

If you want to quickly generate AI portrait photos through a computer or mobile phone, it doesn’t take too much time. It is highly recommended to use Prodia directly. The speed is relatively fast. If you want to produce more detailed and realistic portrait pictures, Prodia is not suitable. Mainly The reason is that the module is not fine enough, and there is no way to produce complex pictures of real people. It is easier to recommend Stable Diffusion. For detailed operation skills, please refer to “Free AI Real-life Drawing Teaching, Teaching You 4 Steps to Generate Realistic Beauty Photos “.

LeetCode 154. Find Minimum in Rotated Sorted Array II

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,4,4,5,6,7] might become:

  • [4,5,6,7,0,1,4] if it was rotated 4 times.
  • [0,1,4,4,5,6,7] if it was rotated 7 times.

Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]].

Given the sorted rotated array nums that may contain duplicates, return the minimum element of this array.

Example 1:

Input: nums = [1,3,5]
Output: 1

Example 2:

Input: nums = [2,2,2,0,1]
Output: 0

Constraints:

  • n == nums.length
  • 1 <= n <= 5000
  • -5000 <= nums[i] <= 5000
  • nums is sorted and rotated between 1 and n times.

Idea:

Divide and Conquer

Solution:

/**
 * @param {number[]} nums
 * @return {number}
 */
var findMin = function(nums) {
    return searchMin(nums, 0, nums.length - 1);
};

function searchMin(nums, l, r) {
    // exit recursion:
    // only one or two elements in the array
    if (l + 1 >= r)
        return Math.min(nums[l], nums[r]);
    // this array is sorted
    if (nums[l] < nums[r])
        return nums[l];
    
    let mid = l + Math.floor((r - l) / 2);
    return Math.min(searchMin(nums, l , mid), searchMin(nums, mid + 1, r));
}

LeetCode 297. Serialize and Deserialize Binary Tree (javascript)

Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.

Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work. You just need to ensure that a binary tree can be serialized to a string and this string can be deserialized to the original tree structure.

Clarification: The input/output format is the same as how LeetCode serializes a binary tree. You do not necessarily need to follow this format, so please be creative and come up with different approaches yourself.

Example 1:

Input: root = [1,2,3,null,null,4,5]
Output: [1,2,3,null,null,4,5]

Example 2:

Input: root = []
Output: []

Example 3:

Input: root = [1]
Output: [1]

Example 4:

Input: root = [1,2]
Output: [1,2]

Constraints:

  • The number of nodes in the tree is in the range [0, 104].
  • -1000 <= Node.val <= 1000

Idea: (Recursion)

We can encodes the tree to a single string.
// # indicates reach to the leave
Convert above tree to 12##34##56## 

Time Complexity O(n)

Solution:

/**
 * Definition for a binary tree node.
 * function TreeNode(val) {
 *     this.val = val;
 *     this.left = this.right = null;
 * }
 */

/**
 * Encodes a tree to a single string.
 *
 * @param {TreeNode} root
 * @return {string}
 */
var serialize = function(root) {
    let res = [];
    serializer(root, res);
    return res.join(",");
};

var serializer = function(root, output) {
    if (root === null) {
        output.push("#");
        return;
    }
    output.push(root.val);
    serializer(root.left, output);
    serializer(root.right, output);
}

// Decodes your encoded data to tree.
var deserialize = function(data) {
    data = data.split(",");
    let index = 0;
    
    function deserializer(data) {
        if(index > data.length || data[index] === "#") {
            return null;
        }
        let root = new TreeNode(parseInt(data[index]));
        index++;
        root.left = deserializer(data);
        index++;
        root.right = deserializer(data);
        return root;
    }
    return deserializer(data);
};

LeetCode 279. Perfect Squares (javascript)

Given an integer n, return the least number of perfect square numbers that sum to n.

perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, 149, and 16 are perfect squares while 3 and 11 are not.

Example 1:

Input: n = 12
Output: 3
Explanation: 12 = 4 + 4 + 4.

Example 2:

Input: n = 13
Output: 2
Explanation: 13 = 4 + 9.

Constraints:

  • 1 <= n <= 104

Idea: (Dynamic Programing)

  • Time complexity: O(n * sqrt(n))
  • Space complexity: O(n)
dp[i] := return the least number of perfect square numbers that sum to i.
dp[0] = 0
dp[i] = min{dp[i – j * j] + 1} and 1 <= j * j <= i ex:[1, 4, 6, 9…]
// For example:
dp[5] = min{
dp[5 – 2*2] + 1 = dp[1] + 1 = (dp[1 – 1*1] + 1) + 1 = dp[0] + 1 + 1 = 2,
dp[5 – 1*1] + 1 = dp[4] + 1 = (dp[4 – 1*1] + 1) + 1 = dp[3] + 2 = 
dp[3 – 1*1] + 1 + 2 = dp[2 - 1*1] + 1 + 3 = dp[1 - 1*1] + 1 + 4 = 
dp[0] + 5 = 5
 };
so dp[5] = 2

Solution:

/**
 * @param {number} n
 * @return {number}
 */
var numSquares = function(n) {
    // Important: n + 1 length because we use dp[0]
    let dp = new Array(n + 1).fill(Number.MAX_VALUE);
    dp[0] = 0;
    for (let i = 1; i <= n; i++)
        for(let j = 1; j * j <= i; j++)
            dp[i] = Math.min(dp[i], dp[i - j * j] + 1);
    
    return dp[n];
};

LeetCode 977. Squares of a Sorted Array

Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.

Example 1:

Input: nums = [-4,-1,0,3,10]
Output: [0,1,9,16,100]
Explanation: After squaring, the array becomes [16,1,0,9,100].
After sorting, it becomes [0,1,9,16,100].

Example 2:

Input: nums = [-7,-3,2,3,11]
Output: [4,9,9,49,121]

Constraints:

  • 1 <= nums.length <= 104
  • -104 <= nums[i] <= 104
  • nums is sorted in non-decreasing order.

Solution 1: (Quick Sort)

/**
 * @param {number[]} nums
 * @return {number[]}
 */
var sortedSquares = function(nums) {
    nums = nums.map(num => num * num);
    quickSort(nums, 0, nums.length - 1);
    return nums;
};

function quickSort(nums, left, right) {
    let index;
    if (nums.length > 1) {
        // index returned from partition
        index = partition(nums, left, right);
        // more elements on the left side of the pivot
        if (left < index - 1)
            quickSort(nums, left, index - 1);
        // more elements on the right side of the pivot
        if (index < right)
            quickSort(nums, index, right);
    }
    // you can return or not return, 
    // since we change nums, no need to return
    // return nums;
}

function partition(nums, start, end) {
    let l = start, r = end;
    let mid = Math.floor((start + end) / 2);
    let pivot = nums[mid];
    // Important: l <= r not l < r
    while (l <= r) {
        while(nums[l] < pivot)
            l++;
        while(nums[r] > pivot)
            r--;
        if (l <= r) {
            // swap
            [nums[l], nums[r]] = [nums[r], nums[l]];
            l++;
            r--;
        }
    }
    return l;
}

Solution 2: (Merge Sort)

/**
 * @param {number[]} nums
 * @return {number[]}
 */
var sortedSquares = function(nums) {
    nums = nums.map(num => num * num);
    let temp = [];
    mergeSort(nums, 0, nums.length - 1, temp);
    return nums;
};

function mergeSort(nums, start, end, temp) {
    if (start >= end) return;
    let mid =  Math.floor((start + end) / 2);
    mergeSort(nums, start, mid, temp);
    mergeSort(nums, mid + 1, end, temp);
    merge(nums, start, end, temp);
}

function merge(nums, start, end, temp) {
    let mid =  Math.floor((start + end) / 2);
    let l_index = start;
    let r_index = mid + 1;
    let index = start;
    while (l_index <= mid && r_index <= end) {
        if (nums[l_index] < nums[r_index]) {
            temp[index++] = nums[l_index++];
        } else {
             temp[index++] = nums[r_index++];
        }
    }
    while (l_index <= mid) {
        temp[index++] = nums[l_index++];
    }
    while (r_index <= end) {
        temp[index++] = nums[r_index++];
    }
    for (let i = 0; i <= end; i++)
        nums[i] = temp[i];
}

LeetCode 79. Word Search (javascript)

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once.

Example 1:

Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"
Output: true

Example 2:

Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"
Output: true

Example 3:

Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"
Output: false

Constraints:

  • m == board.length
  • n = board[i].length
  • 1 <= m, n <= 6
  • 1 <= word.length <= 15
  • board and word consists of only lowercase and uppercase English letters.

Idea:

DFS

Solution:

/**
 * @param {character[][]} board
 * @param {string} word
 * @return {boolean}
 */
var exist = function(board, word) {
    for (let x = 0; x < board[0].length; x++)
        for (let y = 0; y < board.length; y++)
            if (dfs(board, word, 0, x, y)) return true;
    return false;
};

function dfs(board, word, i, x, y) {
    // exit recursion:
    if (x < 0 || y < 0 || x >= board[0].length || y >= board.length || word[i] !== board[y][x])
        return false;
    // found the last letter
    if (i === word.length - 1)
        return true;
    
    let cur = board[y][x];
    // mark it 0 means already visit
    board[y][x] = 0;
    let found = dfs(board, word, i + 1, x + 1, y) || 
                dfs(board, word, i + 1, x - 1, y) ||
                dfs(board, word, i + 1, x, y + 1) ||
                dfs(board, word, i + 1, x, y - 1);
    // recover
    board[y][x] = cur;
    return found;
}

LeetCode 841. Keys and Rooms

There are N rooms and you start in room 0.  Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room. 

Formally, each room i has a list of keys rooms[i], and each key rooms[i][j] is an integer in [0, 1, ..., N-1] where N = rooms.length.  A key rooms[i][j] = v opens the room with number v.

Initially, all the rooms start locked (except for room 0). 

You can walk back and forth between rooms freely.

Return true if and only if you can enter every room.

Example 1:

Input: [[1],[2],[3],[]]
Output: true
Explanation:  
We start in room 0, and pick up key 1.
We then go to room 1, and pick up key 2.
We then go to room 2, and pick up key 3.
We then go to room 3.  Since we were able to go to every room, we return true.

Example 2:

Input: [[1,3],[3,0,1],[2],[0]]
Output: false
Explanation: We can't enter the room with number 2.

Note:

  1. 1 <= rooms.length <= 1000
  2. 0 <= rooms[i].length <= 1000
  3. The number of keys in all rooms combined is at most 3000.

Idea:

DFS

Solution:

/**
 * @param {number[][]} rooms
 * @return {boolean}
 */
var canVisitAllRooms = function(rooms) {
    let visited = [];
    dfs(rooms, visited, 0);
    return visited.length === rooms.length;
};

function dfs(rooms, visited, roomNum){
    // exit recursion:
    if (visited.includes(roomNum)) return;
    
    visited.push(roomNum);
    // possible solution
    for (let key of rooms[roomNum])
        dfs(rooms, visited, key);
}