Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ StatsBase = "0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34"
julia = "1.10"
TestImages = "1.9"

[weakdeps]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"

[extensions]
ImageViewFileIOExt = "FileIO"

[extras]
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You should get a window with your image:
![photo](readme_images/photo1.jpg)

You can use `imshow()` if you want to choose an image using a file
dialog.
dialog (requires [FileIO](https://github.com/JuliaIO/FileIO.jl)).

Try resizing the image window by dragging one of its corners; you'll
see that the aspect ratio of the image is preserved when you
Expand Down
12 changes: 12 additions & 0 deletions ext/ImageViewFileIOExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module ImageViewFileIOExt

using FileIO, ImageView, Gtk4

"""
imshow()

Choose an image to display via a file dialog.
"""
ImageView.imshow() = imshow(load(open_dialog("Pick an image to display")))

end
7 changes: 0 additions & 7 deletions src/ImageView.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ end

const window_wrefs = WeakKeyDict{Gtk4.GtkWindowLeaf,Nothing}()

"""
imshow()

Choose an image to display via a file dialog.
"""
imshow() = imshow(load(open_dialog("Pick an image to display")))

"""
imshow!(canvas, img) -> drawsignal
imshow!(canvas, img::Observable, zr::Observable{ZoomRegion}) -> drawsignal
Expand Down
Loading