Sign In

How to: Creating high(er) resolution landscape images

17

How to: Creating high(er) resolution landscape images

In this short article, learn one way to create landscape format images large enough to serve as computer (or any other screen) backgrounds. I will not go into the gritty details of how upscaling and inpainting works, because I don't really even know the gritty details and I'm bad at math, but I do know how I get the results I want. In my case, I like more exaggerated cartoon-ish but not super cartoonish images, so I'll be using the [Comic Babes v2 checkpoint](https://civitai.com/models/20294/comic-babes) if you want to try it out.

Disclaimer: I know nothing about anything, and am just an enthusiastic Stable Diffusion hobbyist, with zero graphical, artistic, or AI/LLM training. But I like colorful pictures of pretty things on my desktop.

Create your subject

The main subject of your desired image is created with txt2img or img2img, or any of the hundreds of combinations of ways Stable Diffusion allows you to create an image. There are literally thousands of articles out there explaining how to create a pleasing image, so I'll leave that to you.

I personally want a beautiful woman standing on a beach in a bikini, so that's what I'm going to use.

Creation aspect ratio

If you are new to Stable Diffusion, you may believe that if you want to create a landscape picture, you just slide those Width/Height sliders to the desired aspect ratio, and click the Generate button. If you are slightly less new, you will have noticed you can get a radically different image with the same prompt when setting the sliders to 512x512 vs 512x768 vs 768x512.

In the case of a human subject, and in the absence of modifiers specifying the desired pose and camera shot (*or other things like clothing/setting which will also affect the composition, see below), square aspect ratios usually yield portraits, vertical images yield full body shots (or more likely zoomed out portraits), and landscape images yield...zoomed in portraits?

This is an example with few modifiers, and it's SD giving me pretty much what I asked for. I didn't specify anything that says what the subject is wearing, how she is framed, or how she is posing, so I get portraits.

512x512

512x768

768x512

masterpiece, cartoon, (anime:0.5), outdoors, tropical beach resort, stylish Latina woman, 24 years old, (nose freckles:0.45), seductive, slight smile, looking at viewer, glossy black hair, long hair, hair intakes, BREAK dark brown eyes, BREAK best quality,

We can change how much of the subject is visible by including the camera shot and/or pose, or clothing and setting modifiers. For example, specifying no camera angle or specific pose, if bikini bottom is included, you will likely get an image that includes the subject's lower body. The same effect can be had by specifying the camera shot, for instance, cowboy shot or 3/4 shot.

Wait, what? I specified bikini bottom and out of six images I got one that sorta includes the bottom of the bikini?

768x512

masterpiece, cartoon, (anime:0.5), outdoors, tropical beach resort, bikini bottom, stylish Latina woman, 24 years old, (nose freckles:0.45), seductive, slight smile, looking at viewer, glossy black hair, long hair, hair intakes, BREAK dark brown eyes, BREAK best quality,

Let's try those camera shot modifiers. We'll add 3/4 shot and see what we get.

768x512

Oh for the love of... How'd I forget standing? That was what I wanted, let's add that:

768x512

masterpiece, cartoon, (anime:0.5), 3/4 shot, standing, outdoors, tropical beach resort, bikini bottom, stylish Latina woman, 24 years old, (nose freckles:0.45), seductive, slight smile, looking at viewer, glossy black hair, long hair, hair intakes, BREAK dark brown eyes, BREAK best quality,

Well, okay, getting somewhere now, but only 1 of 6 images actually shows the bikini bottom and looks like what I wanted in my image.

You should see that moving those sliders to get the aspect ratio you want doesn't necessarily give you the subject or image composition you want. Now we'll use the predisposition of SD to fill in the aspect ratio to hopefully get a better image.

Getting the right composition

If you haven't lost interest already, you'll remember I pointed out that aspect ratio determines a lot of the image composition. I can try all day to get a cowboy shot of a beautiful woman in a bikini standing on a beach at 768x512, but I'm probably going to get many images that don't show her standing, or show her body.

Let's flip the aspect ratio in txt2img, and go to a 512x768 size:

Hey! We got what we wanted! Standing, 3/4 shot, even that bikini bottom!

768x512

masterpiece, cartoon, (anime:0.5), 3/4 shot, standing, outdoors, tropical beach resort, bikini bottom, stylish Latina woman, 24 years old, (nose freckles:0.45), seductive, slight smile, looking at viewer, glossy black hair, long hair, hair intakes, BREAK dark brown eyes, BREAK best quality,

That image might work for a phone wallpaper, but I'm trying to make a high resolution wallpaper for my sweet 2k PC monitor, I need to cover more space, and get back to that landscape aspect ratio.

Note on background

In a minute, you will be expanding the width of the image, and if you are not planning on spending multiple generations attempting to inpaint difficult areas, avoid using extremely specific singular items in the background. For example, standing in front of a 1957 Chevrolet will yield the center or front of a Chevrolet in this first image, but when expanding the image, you may end up with the left side a dump truck and the right side a lawn mower.

I try to utilize backgrounds in the image that can be somewhat seamlessly expanded by SD, jungle and beach and cityscape work well, but if you have crowded room or the aforementioned large single object, you will have to deal with seams between the original and additional sections of the image.

Note on generation size

When trying to get that first perfect subject, you don't want to use the Upscaler, the generations will go far faster, and since you'll be reassembling the image in img2img and inpaint, you don't need a large, super detailed image yet. Leave it at 1, no Upscaler, and pick the generation that looks like what you want. I do use ADetailer, but that could also wait for a later step.

Aspect Ratio reset

Now we've got our subject, and the image has what we wanted when we started. Time to make it landscape in the Inpaint tab.

Click the inpaint button

Mask the subject

Once the image is in the inpaint tab, we will mask the subject to preserve the image, then select Resize and fill and Inpaint not masked, "Masked content" will be fill and the "Inpaint area" will be Whole picture.

Click the aspect ratio flipper and then adjust your image width with the sliders to 1280x768. 1280x768 is half (approximately) of the desired end resolution of 2560x1440, so we'll upscale in a later step. If you are not using TensorRT, or are just okay with longer generation times, you can set this to exactly half.

I use a batch count of 4 on this step, to generate a few options quickly.

We want SD to be able to redraw the background, but not go completely crazy, so slide the "Denoising strength" to 0.8.

When masking, you can leave anything on the edges that looks problematic outside the mask so it is redrawn. In this example, I am going to redraw those palm tree fronds (not for any specific reason, I'm not anti-palm tree, but to hell with that particular palm tree).

Suck it, palm tree

Flip the aspect ratio and batch count

Ensure ADetailer, Upscale, and the Script dropdown are all inactive/set to "None" and click Generate!

After a few generations, you should find an image that works for you, and doesn't include any glaring inconsistencies (or at least none you can't inpaint back out), so now we'll touch up our chosen image with inpaint to smooth things out.

Again, click the "Inpaint" button below your image, and let it load up.

Inpaint for details

The seams between the original and the extended parts of the image will often not line up correctly, or split objects (or morph a Chevy into a lawn mower), so switch the Mask mode to Inpaint masked, and leave the other settings. I've masked some of the seams, as well as a stray wave and some missing clouds to see if I can even things out here:

Mask the bad seams

If you find you can't address all the issues in one generation, clear the mask and select smaller areas, then inpaint the new "fixed" versions sequentially until all the persistent glitches are removed. If you find too many "new" things are popping up in the spaces you're masking, reduce the Denoising strength to 0.65 or so and try again.

A wild post appears

There's a new post, but the wave is fixed, the clouds are...cloudier, and the island in the background looks inviting. Now we can do a final upscale and see what it looks like!

SD Upscale

With our image now composed and detailed, we can rescale it to the final desktop resolution desired. This step uses the SD Upscale script as well as ADetailer. This is one of those times where there are absolutely more knowledgeable SD users than I that can debate upscaling, but this is what works for me.

Send to img2img

Click the "img2img" button beneath your image, and adjust the Denoising strength down. I use 0.2 as it tends to erase/blend any seams or artifacts better than a lower strength, but the lower the strength, the less your image will be adjusted.

Turn on ADetailer, and select 1st face_yolov8n.pt and 2nd mediapipe_face_mesh_eyes_only.The denoising strength for the ADetailer passes can be adjusted, and I often lower it from the default (0.4) to preserve the generated image more.

Finally, scroll to the bottom of the page, and click the Script menu. Select SD Upscale and then set the desired Scale Factor. In my case, I want to slightly more than double it with "2.1". Select the upscaler you wish to use, R-ESRGAN 4x+ Anime6B and 4x_Fatality_Comix_260000_G are two of my preferred upscalers.

SD Upscale

4xFatality_Comix_260000_G_

R-ESRGAN 4x+ Anime6B

Thanks for reading!

I'm new to SD and know I'm barely scratching the surface of what's possible, so if you have any suggestions, ideas, or comments, let me know!

7

Comments