A downloadable tool

Download NowName your own price

This script is usable in img2img with the automatic1111 GUI for StableDiffusion.

It takes an input image and expands it horizontally to make it tile in order to be usable as an infinite background for side-scrolling games or to make other objects and textures that should only tile in one direction (such as fences, walls, carpets, paths, etc...)

How it works:

the script takes the input image and cuts it in half then moves the halves so that the edges of the original picture are in the center with a gap in-between them (adjustable with the "pixels to expand" setting)

It then inpaints the gap with an adjustable "Mask blur" setting to give you an image which properly tiles horizontally

How to use:

  1. place the horizontal_scroll.py file into your "stable-diffusion-webui/scripts/" folder then restart the GUI.
  2. navigate to img2img
  3. bring in an image you want to tile (such as a background)
  4. Select "Tile Horizontally" from the Script section and modify the settings for it.
  5. adjust the usual Stable-diffusion settings for your specific image and use-case
  6. click Generate

New Feature:

Width limiter has been added. This is an optimization to make it run quicker and to allow for far larger images to be used as input.

When enabled, the img2img region is cut to the width_limit so, for example, if you have a 1024x768 input image and you use a width_limit of 512 then the img2img region will be 512x768 instead of 1024x768 which would make it run twice as fast.

The result will still be the same size, this only affects the img2img step of the script.

lower width_limit values will be faster but they give img2img less to reference, so it's advised to make it atleast double the "pixels to expand" value


  • "Just resize" and "Crop and resize" work but "Resize and fill" acts the same as "Just Resize"
  • batch_count works but batch_size doesn't yet
  • unlike the default outpainting scripts, the width and height are implemented and control the size of the input image here, so I suggest choosing the same size or at-least the same aspect-ratio as the input image, although the "just resize" and the "Crop and Resize" function properly if that works for you
  • The script crops the image to the input size before running the inpainting so if you generated the input image with text2img, even if it was the max resolution you can do with your Graphics card, you should be able to still run this script to tile it despite it expanding the image.
StatusIn development
Rated 5.0 out of 5 stars
(2 total ratings)
Tags2D, ai, Backgrounds, python, script, sourcecode, stable-diffusion, tiling, tool


Download NowName your own price

Click download now to get access to the following files:

horizontal_scroll.py 5 kB

Leave a comment

Log in with itch.io to leave a comment.