{"id":5379,"date":"2026-03-10T07:10:05","date_gmt":"2026-03-10T11:10:05","guid":{"rendered":"https:\/\/dft.wiki\/?p=5379"},"modified":"2026-03-10T20:51:20","modified_gmt":"2026-03-11T00:51:20","slug":"ai-image-transformation-image-to-image","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=5379","title":{"rendered":"AI Image Transformation &#8211; Image-to-Image"},"content":{"rendered":"<p><strong>IMAGE-TO-IMAGE<\/strong><\/p>\n<p>While <strong>Text-to-Image<\/strong> starts the inference process from absolute random noise, <strong>Image-to-Image<\/strong> partially diffuses an existing image and then denoises it to introduce new features based on a prompt.<\/p>\n<p>Since the pipeline receives an image as its initial input, the file must be loaded into memory before processing.<\/p>\n<pre>from PIL import Image\r\nfrom diffusers import StableDiffusionImg2ImgPipeline\r\n\r\npipe = StableDiffusionImg2ImgPipeline.from_pretrained(\r\n    <strong>\"stable-diffusion-v1-5\/stable-diffusion-v1-5\"<\/strong>,\r\n)\r\n\r\nresult = pipe(\r\n    prompt=\"<strong>Smiling face.<\/strong>\",\r\n    image=<strong>Image.open(\"flower.png\").convert(\"RGB\")<\/strong>,\r\n    strength=<strong>0.5<\/strong>,\r\n    guidance_scale=<strong>7.5<\/strong>,\r\n).images[0]\r\n\r\nresult.save(\"<strong>output.png<\/strong>\")<\/pre>\n<p>Note the new parameter: <strong>strength<\/strong>. It controls the amount of noise added to your input image before the denoising process begins. High strength values allow for more creative freedom, while low values stay closer to the original.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<ul>\n<li>For a total of 20 inference steps, a strength of 0.2 means 20% of changes,\n<ul>\n<li>20 * 0.2 = 4 denoising steps will be applied.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>See the final steps of inference that transformed the flower into a smiling face..<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5362\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/image-to-image.png\" alt=\"\" width=\"1208\" height=\"137\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/image-to-image.png 1208w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/image-to-image-300x34.png 300w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/image-to-image-1024x116.png 1024w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/image-to-image-768x87.png 768w\" sizes=\"auto, (max-width: 1208px) 100vw, 1208px\" \/><\/p>\n<p><strong>Note:<\/strong> It is not possible to make changes to only a specific area of the image because it will evenly apply noise all over the image.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5364\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/output1.png\" alt=\"\" width=\"512\" height=\"256\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/output1.png 512w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/output1-300x150.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5365\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/output2.png\" alt=\"\" width=\"512\" height=\"256\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/output2.png 512w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/output2-300x150.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>For more details and reference, see my own code used to generate the images above at <strong>Image2Image<\/strong> [<a href=\"https:\/\/github.com\/davift\/Image2Image\">Link<\/a>].<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5369\" src=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/Screenshot_2026-03-09_10-41-42.png\" alt=\"\" width=\"975\" height=\"1192\" srcset=\"https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/Screenshot_2026-03-09_10-41-42.png 975w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/Screenshot_2026-03-09_10-41-42-245x300.png 245w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/Screenshot_2026-03-09_10-41-42-838x1024.png 838w, https:\/\/dft.wiki\/wp-content\/uploads\/sites\/15\/2026\/03\/Screenshot_2026-03-09_10-41-42-768x939.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>IMAGE-TO-IMAGE While Text-to-Image starts the inference process from absolute random noise, Image-to-Image partially diffuses an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-5379","post","type-post","status-publish","format-standard","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/5379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5379"}],"version-history":[{"count":3,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/5379\/revisions"}],"predecessor-version":[{"id":5408,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/5379\/revisions\/5408"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}