{"id":5379,"date":"2026-03-10T07:10:05","date_gmt":"2026-03-10T11:10:05","guid":{"rendered":"https:\/\/dft.wiki\/?p=5379"},"modified":"2026-06-08T09:40:39","modified_gmt":"2026-06-08T13:40:39","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 from pure 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 takes an image as input, it 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 how much noise is added to the input image before denoising begins. Higher values allow more creative freedom; lower values stay closer to the original.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<ul>\n<li>With 20 inference steps and a strength of 0.2, only 20% of steps are applied:\n<ul>\n<li>20 \u00d7 0.2 = 4 denoising steps.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>The images below show the final denoising steps 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 edit a specific area of the image, as noise is applied uniformly across the entire 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 the full code used to generate the images above, see <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 from pure random noise, Image-to-Image partially diffuses an existing image and [&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":4,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/5379\/revisions"}],"predecessor-version":[{"id":5589,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/5379\/revisions\/5589"}],"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}]}}