Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow manually changing canvas size #92

Closed
vaunchag opened this issue May 9, 2020 · 21 comments
Closed

Allow manually changing canvas size #92

vaunchag opened this issue May 9, 2020 · 21 comments
Assignees
Projects

Comments

@vaunchag
Copy link

vaunchag commented May 9, 2020

FR:
Enhance the crop tool to permit the user not only to crop, but also to extend the canvas of the image (in any choosen direction, as per user preference).

Tool name may be changed for discoverability of this feature.

Initial reason is to control results (specially the extra margin) when doing out of border annotations (see #90).

Besides, even without out of border annotations involved, it is a nice to have feature: being able to directly add external borders (for aesthetics, for controlling the final aspect ratio, ...).

Also related with #91 when implemented (the extension should fill with that chosen color).

@DamirPorobic DamirPorobic changed the title Add "extend" to the crop tool (configurable canvas size) Allow extending canvas size Dec 18, 2020
@DamirPorobic DamirPorobic added this to To do in v0.5.0 via automation Dec 18, 2020
@DamirPorobic
Copy link
Member

I would prefer to have a separate option for this, leaving the crop as it is and adding new option called Extend Canvas area or Extend Scene like it's called in Qt terms.

@c33s
Copy link

c33s commented Dec 18, 2020

i only can give feedback from photoshop perspective, it is really handy to have it in the crop-tool.
my suggestion would be to add it as extra "tool" but allow to enable the function for the crop tool.

@DamirPorobic
Copy link
Member

In Photoshop it's part of the crop tool? I try to align to well known tools, they have usually more experienced people around UI design. It is even simpler to allow it in the crop tool because it's simple removing a restriction

@c33s
Copy link

c33s commented Dec 18, 2020

2OU87PLf1V

edit: but it's photoshop cs6 don't know about the cloud version (it is simply to expensive for me)

@DamirPorobic
Copy link
Member

Interesting, then lets go with the crop.

@vaunchag
Copy link
Author

vaunchag commented Dec 19, 2020 via email

@DamirPorobic DamirPorobic moved this from To do to In progress in v0.5.0 Dec 28, 2020
@DamirPorobic DamirPorobic self-assigned this Dec 28, 2020
@DamirPorobic
Copy link
Member

I'm currently looking into this and I'm not all to happy with the combined Crop and Extend, the behavior is kind of strange that sometimes the images is cut of and sometimes not. I'll try now with two separate controls, one that can crop the background image, which cannot be extended beyond the background image (this is what we have already) and one extend or resize canvas that can increase the canvas size but cannot be shrinkt below the background image size. Later on we might add here a selection for the canvas fill.

@DamirPorobic
Copy link
Member

The name could be something like "Adjust Canvas", that might allow doing other canvas operations here

@vaunchag
Copy link
Author

vaunchag commented Dec 28, 2020 via email

@DamirPorobic
Copy link
Member

Take for example an Image that you have captured 500x500 px, you open crop, cut one half of it of, the visible image is now 250x500 px and the canvas has the same size. You open the crop tool again, extend the canvas size to be again 500x500, but you don't get the one half of the image back.

If you don't cut the half of of the image, you can't see that anything happened, there is not border to show you what part of image is going to get into final image when you export it.

Those scenarios confused even me while I was testing the feature.

I think keeping it in two tools might be more clear to users what they can do here and what not. That you need to use both tools is probably going to be a rare scenario and yes, might require opening two tools.

@c33s
Copy link

c33s commented Dec 28, 2020

can we have a config for this? only because it's confusing for one it can be helpful for the other

@DamirPorobic
Copy link
Member

DamirPorobic commented Dec 29, 2020

A config is not going to work for this as the change would affect several places, making the code harder to maintain. I think that the solution I'm working on could work for for everyone. Basically the crop functionality is just used to remove parts of the background image like before, no change here. The Modify Canvas option can be used to resize the canvas which is currently by default a union rect of background Image + all items + image effects, like this (existing functionality, just now visible):
image

By default it can be extended to any size you desire and is restricted to shrink only to the size of the background image:
image

Though this restriction can be disabled with the checkbox, then you can shrink like you want.

What you finally see in this rect, will be exported when saving the image, even when the canvas is smaller then the image, like this, only the not dimmed part will be exported:

image

Hope this satisfies most wishes, I can't see any use case that could easier (with less operations) be achieved with a combined crop tool, if you wanted to cut a piece out on the right side and then increase the canvas in that direction, you would have need to use the combined crop tool twice. If you want to hide the right side and extend the canvas to the left side, this can be done now with just the modify canvas tool, opening it once.

The thing is not finished, I'm still working on it and need to test it a bit further, might be finished tomorrow.

@vaunchag
Copy link
Author

It looks quite good to me!

@DamirPorobic DamirPorobic changed the title Allow extending canvas size Allow manually changing canvas size Dec 30, 2020
@DamirPorobic
Copy link
Member

I'm done, give the CI some time to build, the feature should be available in latest continuous build.

v0.5.0 automation moved this from In progress to Done Dec 30, 2020
@vaunchag
Copy link
Author

Thank you very much!

I've tested it and looks good (although it took me a time to find where the new functionnality was). A couple of things:

  • I think that modify Canvas should be considered like a "change", so that the file can be saved after it. Currently when changing the canvas the file cannot be saved with "only that change". One needs to do a further annotating action that triggers a change (an undo as a workaround if only the canvas change is desired).
  • As per our recent comments on Canvas background color configurable #91, I confirm that it looks strange not having the visual feedback of what is saved. It is odd the need to "have a look" each time to the "View > Modify Canvas" menu just to see/confirm what is the current canvas and what is going to be saved.

@DamirPorobic
Copy link
Member

Good catch, forget about the first point. Will push a change in couple of minutes.

Regarding second point, yes, I agree, we need to address that with #91. Let's see how that change improves the visibility and take it from there. I hope I can provide something to test by end of the week.

@DamirPorobic
Copy link
Member

Changed pushed, give the CI some time to finish the build.

@vaunchag
Copy link
Author

God, you're quick!
I'll test when available (your push is from 5h ago, but not yet available... not sure what is the normal time for the CI).
Regarding #91, no rush at all! I just gave the confirmation that, once tested as it is now, it looks unintuitive... but the functionality is already there and can at least be used. Great!

@DamirPorobic
Copy link
Member

It was just a minor fix :)

The CI is slow lately, takes ~50min but you're right, can't see the build items. I have triggered it again.

I'm working already on #91, I think it looks quite nice. Over that would come the canvas color, what ever you have picked there:

image

@vaunchag
Copy link
Author

Curiously, the new build isn't appearing... I'll wait for next year. :-)

Your proposal for #91 looks great! I assume that the checkboard represents transparency (as per usual convention).

@vaunchag
Copy link
Author

vaunchag commented Jan 5, 2021

Just confirming here that I also tested successfully this one. Many thanks again!

As a side note, for your information: I have recently recalled the editing interface of Shutter (the quite good Linux-only annotation tool now discontinued). The editor there constantly "offers" the canvas resize handlers permiting freely enlarging and reducing at any moment:

image

I still find having this option quite convenient and "safe": the handlers are ofered and visible, but one does not have to use them if not interested in resizing the canvas.

Limitations there of things that may be often needed:

  • Does not allow resizing the up or left sides.
  • Does not permit setting the filling color (always transparent, in this case).

Both limitations are now covered by ksnip :-) ... although in a indirect modal window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

3 participants