zero01101 / openOutpaint

local offline javascript and html canvas outpainting gizmo for stable diffusion webUI API 🐠
MIT License
503 stars 44 forks source link

Rotate Canvas #156

Closed guzuligo closed 1 year ago

guzuligo commented 1 year ago

Some models are trained on new stuff that look good when they are up straight. Once rotated, the model miss it up.

A great feature would be if we could rotate the canvas for the model so it gets it right.

seijihariki commented 1 year ago

Hi! What do you mean rotation of the canvas? The canvas itself, as well as the dream size can be done in portrait-like proportions.

guzuligo commented 1 year ago

Proportions won't help. For example, if I have a rotated 45 degrees camera shot of a man, and I try image to image on it, the face suddenly becomes a monster.

If I manually rotate the image and img2img, it works perfectly.

Alternatively if an image could be sent to the API in a rotated form, like rotating the cursor, that would also do the trick.

seijihariki commented 1 year ago

Oh, now I understand exactly what we have to do! We actually have a similar feature request on the main repo, and we are on the process of implementing this.

For now, our goal is to add rotation support on select tool and stamp tool. Would that work for you?

seijihariki commented 1 year ago

As this has more to do with openOutpaint itself, will transfer the Issue to the main repo.

seijihariki commented 1 year ago

Hi, could you try the rotate branch?

Just go into the directory of openOutpaint (extensions/<extension>/app for extensions) and git checkout rotate.

If using the extension, DO NOT restart the webui after running this command, just reload openOutpaint via the 'Refresh openOutpaint' button.

guzuligo commented 1 year ago

Ok, I did git checkout rotate and see nothing Did, git pull and couldn't find it I decided to restart the webui, but still nothing 😅

From https://github.com/zero01101/openOutpaint e2afee3..b590b6d rotate -> origin/rotate Updating e2afee3..b590b6d Fast-forward index.html | 14 ++-- js/config.js | 15 +++++ js/initalize/debug.populate.js | 2 - js/ui/tool/dream.js | 42 +++++++++++- js/ui/tool/generic.js | 75 +++++++++++++++++----- js/ui/tool/select.js | 123 ++++++++++++++++++----------------- js/ui/tool/stamp.js | 142 ++++++++++++++++++++++++++++++++++------- 7 files changed, 305 insertions(+), 108 deletions(-)

guzuligo commented 1 year ago

Where should I find the rotate option?

seijihariki commented 1 year ago

Now you should run git checkout rotate and reload the openOutpaint page

guzuligo commented 1 year ago

Ok, it seems for some reason, my browser isn't clearing the cache even after i delete the cache.

Now I see scale option on stamp. Works fine. But can't find anything about rotate.

Though, stamp is a bit tricky to use when you want to stamp layers behind as it blocks all layers image

seijihariki commented 1 year ago

For stamp rotating is with LMB drag (wheel finetune is shift+wheel). We can try implementing something like select peek for stamp...

seijihariki commented 1 year ago

Rotating is also possible using the select tool itself.

guzuligo commented 1 year ago

How? Can't find the option ... or the hot key

seijihariki commented 1 year ago

No hotkey needed... Dragging with the left mouse button on stamp just rotates the stamp automatically

seijihariki commented 1 year ago

Select tool has a new rotate handle.

guzuligo commented 1 year ago

Where? In the middle? Corner?

guzuligo commented 1 year ago

It just scales: image

seijihariki commented 1 year ago

You are not in the rotate branch apparently:

https://user-images.githubusercontent.com/7552751/212235442-e0211f1f-e6b4-4581-98a0-ae63c2d0193c.mp4

seijihariki commented 1 year ago

Let me test with chrome

seijihariki commented 1 year ago

Chrome also seems to work:

https://user-images.githubusercontent.com/7552751/212235766-e48c2dd0-a53d-4920-99c8-a8b32101d0e3.mp4

guzuligo commented 1 year ago

Ok, it seems I opened the browser that doesn't clear cache 😅 Now I see it 🥲

seijihariki commented 1 year ago

Ok! Oh, and shift when rotating snaps to multiples of 45 degrees.

guzuligo commented 1 year ago

Yup! It solves a lot of problems 😱😂 image

guzuligo commented 1 year ago

YES!!! Now I even fixed the damaged ones! image

Fixing is not as easy as rotating the img2img cursor. But, still works like charm. And has more applications than just the cursor rotation 👍👍