Closed riegaz closed 11 years ago
Closing the window is already possible already through the first output, but it's not as easy as it should be. The pull request referenced above would make it much easier.
What do you mean by "update"? The combination of the first and second outputs lets you call several of the functions in ImageView directly, notably resize
and redraw
. Need something different?
Hey Tim, I'm trying to do the same thing here and don't think I understand the API fully.
I am writing an implementation of Seam Carving for Content-Aware Image Resizing (PDF), and so I want to do things like draw into the same window multiple times, preferably with the ability to output an image of different dimension each time. (Resizing the window frame itself would be nice as well). Can you post an example of the code needed to do that?
Thanks for the explanation. Right now redrawing with an image of different dimensions is not supported. This is fixable, of course.
I'm on vacation right now and about to disappear for a multi-day backpacking trip, so now is not the time to push a possibly-breaking change. I'll try to get to this next week.
@riegaz, @staticfloat this is done now. Sorry it took so darn long.
Here's a demo:
julia> using ImageView
julia> using TestImages
julia> lh = testimage("lighthouse.png")
RGB Image with:
data: 3x768x512 Uint8 Array
properties:
limits: (0x00,0xff)
colordim: 1
spatialorder: ["x","y"]
colorspace: RGB
julia> mand = testimage("mandrill.tiff")
RGB Image with:
data: 3x512x512 Uint8 Array
properties:
limits: (0x00,0xff)
colordim: 1
spatialorder: ["x","y"]
colorspace: RGB
julia> imgc, img2 = display(lh,pixelspacing=[1,1])
(ImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,768.0,0.0,512.0))
julia> display(imgc, mand)
(ImageCanvas,ImageSlice2d: zoom = BoundingBox(0.0,512.0,0.0,512.0))
Also, running "test/tile.jl" is fun.
Awesome, thanks @timholy!
I went back and re-read the issue, and noticed you folks asked a few more questions. So here are some other tidbits:
display(canvas(imgc), mand)
. canvas
returns a Tk
Canvas
object. You can add settings after the image (mand
) if you want (e.g., pixelspacing=[2,1]
).destroy(toplevel(imgc))
(toplevel
returns the window)set_size(toplevel(imgc), w, h)
These features require master; I'll update the sha1 soon, but Ron Rock indicated he may also have some new stuff coming, so I'll wait a bit.
I'm done now, but see the comment on the latest commit...
An option to give the display an instance would be nice. Would be great to be able to close/update the display from within Julia.
Will there be something like that in future?