Git Product home page Git Product logo

sd2upscaler's Introduction

sd2upscaler

A tiling prompt-guided super-resolution and outpainting CLI tool based on huggingface diffusers library and stability.ai's Stable Diffusion v2.1 upscaling and outpainting models.

Motivation

I created this tool to help making large-format prints of AI artworks. The upscaling is nescessary to improve visual quality (a 600-dpi print on 13x19 paper looks terrible with a 1k x 1.5k pixel source image. Upscaling x4 to 4k x 6k is a drastic improvement) and adapt images to the paper aspect ratio which would otherwise need to be letterboxed or cropped (using outpainting, it's not perfect but is often preferable to cropping.)


Usage: sd2upscaler.py [OPTIONS] [SOURCE_IMAGES]...

Options:
  --dest-dir TEXT                 The directory to save the output images to.
                                  If not specified, the output images will be
                                  saved to the same directory as the source
                                  image.
  --dest-name TEXT                Name template for output images.
                                  Substiutions: {parent} parent dir of source
                                  image, {name} name of source image, {ext}
                                  extension of source image. Default:
                                  {name}-sd2out{ext}
  --prompt TEXT                   The default prompt to use.
  --negative-prompt TEXT          The default negative prompt to use.
  --outpaint-aspect-ratio TEXT    Outpaint the image to the specified aspect
                                  ratio (overrides --outpaint-top, --outpaint-
                                  bottom, --outpaint-left, --outpaint-right)
  --outpaint-fill-only            Output the pre-processed image normally fed
                                  through the SD2 inpainting model as-is.
                                  (overrides --outpaint-top, --outpaint-
                                  bottom, --outpaint-left, --outpaint-right)
  --outpaint-prompt TEXT          The prompt to use for outpainting. Can be
                                  overridden per side.
  --outpaint-negative-prompt TEXT
                                  The negative prompt to use for outpainting
                                  the image. Can be overridden per side.
  --outpaint-guidance-scale FLOAT
                                  The guidance scale to use for processing.
  --outpaint-num-inference-steps INTEGER
                                  The number of steps to use for processing.
  --outpaint-feather INTEGER      The width of the blended transition between
                                  the outpainted area and the original images
                                  edge pixels
  --outpaint-top INTEGER          How many pixels to add to the top of the
                                  image with outpainting.
  --outpaint-top-prompt TEXT      The prompt to use for outpainting the top
                                  side.
  --outpaint-top-negative-prompt TEXT
                                  The negative prompt to use for outpainting
                                  the top side.
  --outpaint-bottom INTEGER       How many pixels to add to the bottom of the
                                  image with outpainting.
  --outpaint-bottom-prompt TEXT   The prompt to use for outpainting the bottom
                                  side.
  --outpaint-bottom-negative-prompt TEXT
                                  The negative prompt to use for outpainting
                                  the bottom side.
  --outpaint-left INTEGER         How many pixels to add to the left of the
                                  image with outpainting.
  --outpaint-left-prompt TEXT     The prompt to use for outpainting the left
                                  side.
  --outpaint-left-negative-prompt TEXT
                                  The negative prompt to use for outpainting
                                  the left side.
  --outpaint-right INTEGER        How many pixels to add to the right of the
                                  image with outpainting.
  --outpaint-right-prompt TEXT    The prompt to use for outpainting the right
                                  side.
  --outpaint-right-negative-prompt TEXT
                                  The negative prompt to use for outpainting
                                  the right side.
  --upscale                       Whether to upscale the image. (default:
                                  False)
  --upscale-prompt TEXT           The prompt to use for guidance when
                                  upscaling the image.
  --upscale-negative-prompt TEXT  The negative prompt to use for the image.
  --upscale-tile-size INTEGER     The size of the tiles to use for upscaling.
  --upscale-tile-overlap INTEGER  The overlap of the tiles to use for
                                  upscaling.
  --upscale-guidance-scale FLOAT  The guidance scale to use for upscaling.
  --upscale-num-inference-steps INTEGER
                                  The number of steps to use for upscaling.
  --upscale-add-predicted-noise FLOAT
                                  The noise level to use for upscaling.
  --upscale-noise-level FLOAT     The noise level to use for upscaling.
  --help                          Show this message and exit.

sd2upscaler's People

Contributors

un1tz3r0 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.