weiseng18 / wallpaper

generate a wallpaper from a square image

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wallpaper

Given a square image, this script creates a wallpaper with

  • an upscaled, blurred version of the image in the background, and
  • an upscaled version of the image in the foreground.

Usage

./run <path-to-image>

  • Writes to output.png in the current directory.
  • Reads config.json in the current directory for config. See below for the format of this file.

Example

Input Output Config
{
    "bg": {
        "blur": 15,
        "delta": 60
    },
    "fg": {
        "upscale": 2,
        "border": 0
    },
    "rotate": 0,
    "height": 2778,
    "width": 1284
}
{
    "bg": {
        "blur": 25,
        "delta": 0
    },
    "fg": {
        "upscale": 2,
        "border": 10
    },
    "rotate": 90,
    "height": 2778,
    "width": 1284,
    "enable_fg": true
}
{
    "bg": {
        "blur": 25,
        "delta": 0
    },
    "fg": {
        "upscale": 2,
        "border": 10
    },
    "rotate": 90,
    "height": 1080,
    "width": 1920,
    "enable_fg": true
}
{
    "bg": {
        "blur": 0,
        "delta": 0
    },
    "fg": {
        "upscale": 1,
        "border": 0
    },
    "rotate": 0,
    "height": 2778,
    "width": 1284,
    "enable_fg": false

}

Config file

The config file is a JSON file with the following structure:

{
    "bg": {
        "blur": 15,
        "delta": 60
    },
    "fg": {
        "upscale": 2,
        "border": 0
    },
    "rotate": 0,
    "height": 2778,
    "width": 1284,
    "enable_fg": true
}
  • bg:
    • blur: Gaussian blur sigma for the background image.
    • delta: Crop the background image by this amount (in pixels) on the top and bottom.
  • fg:
    • upscale: Upscale the foreground image by this factor.
    • border: Add a white border to the foreground image of this width.
  • rotate: The amount to rotate the original image by (counter-clockwise, in degrees)
  • height: The height of the output image.
  • width: The width of the output image.

About

generate a wallpaper from a square image


Languages

Language:MATLAB 91.8%Language:Shell 8.2%