-
Notifications
You must be signed in to change notification settings - Fork 17
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
incorrect closed
behavior
#65
Comments
BTW, I noticed that usage like julia> img = zeros(RGB, 10, 10)
julia> isconcretetype(eltype(img))
false As an alternative, one should use |
Isn't that the intended behavior? Since what boundary fill does is to avoid a particular color and fill everything else, and when there are no boundaries it fills everything. Do we want it to not work at all if |
Okay... So my next question is: is there a way to generate a non-constant image using BoundaryFill with |
Similarily, if img = zeros(RGB{Float64}, 10, 10)
verts = [CartesianIndex(2, 2), CartesianIndex(2, 6), CartesianIndex(6, 2)]
alg = BoundaryFill(3, 3; fill_value = RGB{Float64}(1), boundary_value = RGB{Float64}(1))
draw(img, verts, alg; closed=true) |
This is the only case I think when it will stop before filling everything As for the verts, that choice of making first and last same has something to do the way closed polygon were made here: Line 9 in 54f3cfe
It's not optimal, we can change that. Or we can document that first vert needs to equal to last vert. |
I never liked the original ImageDraw design and implementations; the usage is too fragile... but always find more important/urgent things to do when I try to put my hands on this package.
If we change
I see two options: 1) throw an error/warning 2) silently push the first index to the last. I prefer the first version, i.e., throw an error/warning. A warning is perhaps sufficient, I guess. |
Me too. I never really needed ImageDraw myself but perhaps there is good motivation to handle these geometric drawings with an existing library for geometric processing and have a single helper function that rasterizes the drawing into images? We are building so much functionality in Meshes.jl for example that it would be straightfoward to take a geometry from there and rasterize with a single function. What do you think @johnnychen94 ? Maybe I misunderstood the goal of ImageDraw, but if is just drawing geometries in an pixelated array, I would definitely consider adding Meshes.jl or Luxor.jl as a dependency, drawing with existing functions and then writing a single rasterize function here to convert axis coordinates to image coordinates, etc. |
I'm not a graphics expert so I can't say for sure what the best targeting form of ImageDraw.jl is. Right now, it's a convenient and lightweight tool for image visualization purposes to me. The key difference between ImageDraw.jl and other packages is that the input/output of If we plan to redesign the codes, https://github.com/GiovineItalia/Compose.jl is a pretty good interface I have in mind. |
Maybe a simple conversion function would do the job. One for rasterizing the vector geometries and another for vectorizing the raster images. I would definitely consider adding Compose.jl or similar library as dependency to avoid reinventing the wheel and then would concentrate the efforts on these two conversion functions. That way users could draw more advanced geometries and text on images without effort. |
I'm not sure if this is an expected behavior or not:
closed=false
is an all-white image:cc: @ashwani-rathee
The text was updated successfully, but these errors were encountered: