-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Image
proposal
#5055
Comments
Great issue and mockups @pngwn! Sharing my thoughts on the various pieces of the proposal: Backgrounds Looks great. The paste icon will be very welcome!
... all this seems kind of complicated, and I have not heard people specifically ask for a solid color as a background image before. Maybe we leave this out of v1? The only part I'd push against is requiring a Python class to hold parameter options. I do see the point about providing additional flexibility down line, but I strongly think that we should make the common use cases as simple as possible for users. One way to do that would be to accept either a list of sources, or an instance of
I think so, it could help people discover all the various sources. Transforms Again, I think it should be either a list of tools or an instance of the class. I personally find the parameter name
No I don't think so, we can just do
I agree that the
Exactly, very cool. Since this is such a common use case, I would again suggest bringing Drawing Proposed changes look quite nice. I'm personally more okay to have
This seems like a very strong assumption. What if users want to have a single color but have different layers, or have many colors in a single layer? Why not just let users create new layers by clicking a button and then they can switch through the different layers as needed.
Nice Function signature Ok so I do like the proposed function signature, particularly as it allows easy access to both the individual layers as well as the composite image. However, this makes easy things (like image classification or image generation) much harder because now users have to deal with a dictionary inside their inference function. Which leads me to my main suggestion... What if we separated The basic idea is that
Mockups Look really nice! |
Just to clarify on the use of classes. I was suggesting a list of strings (literals) or the class when a user needs to set options for any of the individual tools. Except for brush/ eraser just because there are so many possible options. On bg colour, I don't feel very strongly but think it would easy to add and seems like something people might want to do. I've seen @hysts generate solid bg images before and this would be easier. On the layers, I think the auto layer thing would be way nicer when drawing masks. For other usecases it isn't as valuable. Maybe we could have a flag for it. I'd be fine with a separate image component with a simpler signature. |
👍 looks like we're on the same page on all of these points |
This looks really cool. If there's no tool activated (which is the default I guess) are there changes from the current image component? I'm asking because it would be great to have some options to size the image component inside apps. |
Sorry @gary149, I missed this. When you say 'size the image component inside apps', what do you mean exactly? |
Is your feature request related to a problem? Please describe.
We have many issues with the current
Image
component, some of which are difficult to resolve.Describe the solution you'd like
A new
Image
component.This issue is a continuation and refinement of #466. More specifically it is an actual proposal for a new
Image
component. This first iteration will aim for parity with the current component while addressing a few core limitations and bugs.I will first list the feature list across both the python API and the GUI, then I'll drop down into the details.
Features fall roughly into one of three categories. Sources or Backgrounds, Transforms, Drawing.
Backgrounds
Many use cases require a background image which can either exist on its own or act as a base image to be modified with other tools.
Proposal
Python API
A list of sources to allow in the form:
bg_source=['upload', 'webcam', 'paste', 'color']
.Where options need to be set could we use a class instead?:
GUI
The GUI should display all allowed options.
color_mode="fixed"
andcolor_swatches
is a single color, then set the bg to that colorcolor_mode="fixed"
show a swatch panel with the provided colors. Selecting a color sets the bg.color_mode="defaults"
show a swatch panel with the provided colors and a colorpicker or+
icon. Selecting a swatch colors sets the bg. Selecting the+
icon opens a colorpicker. 'picking' a color sets the bg.Questions
bg_color
be a set of swatches with a+
icon that jump to a colour picker? (I'd like this personally, suggested API above)Transforms
After an image for sketch has been generated, it is sometime necessary to transform the image.
Proposal
Support the following transform tools:
Python API
Similar to the background source I think these should be settable as a list of tools:
transforms=['crop', 'resize', 'rotate']
with options available as a class similar to above. We could maybe put the currentshape
kwarg into this which makes more sense because it is a crop/resize really:GUI
The tools selected will be shown.
crop_size
has been set then the canvas and any background images will be resized to fit those constraints, users could modify the crop by selecting the crop tool which will be fixed to that ratio. The crop overlay could be moved and the image zoomed but the crop overlay would not be editable. This is basically 'shape' but with a GUI.Drawing
Drawing tools are essential for freeform sketching and masking. We should allow more flexibility + constraints to the python developer when creating their image components.
Proposal
Each mask color should become a new layer. Reselecting a color that has previously been used will add to that existing layer.
Python API
I think we should replace our existing
brush_color
andbrush_radius
options with something more flexible. Any options we have for brush, we probably need for eraser as well (other than color).GUI
Pretty much as before. The UI will only show what has been passed into the python API. Brushes + eraser work similarly to color swatched before.
Other things
Function signature
We have a few issues with the pre+postprocess signature for Image right now. The big one being how the shape changes depending on how the component is feeling on a given day. We also have users who want different things, some want separate layers, others want a composite image. I propose a fixed signature of this:
"image" is just whatever image formats we support/ want this to be. Color is a new thing I just invented because bgs can be simple.
bg
this is the background image or color as its own imagelayers
these are the mask or sketch layers, this is a list because there could be manycomposite
this is all of the layers squished into a single imagePassing in masks
We can support passing in masks + bg images via the API (or returning them from an inference fn). I think we should support two ways of doing this. bg images should be settable to either an image or a color, just like the UI supports. Masks should be settable to either an image or 'mask data'.
I think the 'mask' data case is important because people may want to programmatically generate masks without generating an image. I propose a helper class for this:
lmk!
Layout
Few ideas around layouts below. This is what I was thinking in terms of keeping things simple + straightforward, but also (crucially) this kind of layout is pretty mobile friendly.
The text was updated successfully, but these errors were encountered: