hellosiyan / Viewnior

Elegant Image Viewer
https://siyanpanayotov.com/project/viewnior/
GNU General Public License v3.0
320 stars 54 forks source link

support clipboard #72

Open lizhuangs opened 4 years ago

lizhuangs commented 4 years ago

support copy image to clipboard,Tks~

juherask commented 4 years ago

I agree, this would be really nice feature.

duckduck1 commented 4 years ago

Missing that feature, too. It would keep Viewnior simple but functional.

JakkuSakura commented 3 years ago

It would be very helpful to post pics in Github issues. Currently, I use my screenshot.

ppdeassis commented 3 years ago

Looking forward to it too.

AlbertHamik commented 3 years ago

Not to hijack this too much but would it be possible to do the reverse, pasting from clipboard into Viewnior? In Windows I often use the paste image feature of Irfanview to confirm how a screenshot turned out. If I need to start another thread for this I can.

hajonnes commented 1 year ago

I agree, both functionalities would be really nice.

cpontvieux-systra commented 2 weeks ago

Ristretto can do it, is free and is also in C, so it may be simple to borrow the code…

[Edit] I found this: https://gitlab.xfce.org/apps/ristretto/-/blame/master/src/main_window.c?ref_type=heads#L4314

{
    GdkPixbuf *pixbuf;
    RsttoImageViewer *viewer;
    viewer = RSTTO_IMAGE_VIEWER (window->priv->image_viewer);
    pixbuf = rstto_image_viewer_get_pixbuf (viewer);
    if (pixbuf)
    {
        gtk_clipboard_set_image (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), pixbuf);
        g_object_unref (pixbuf);
    }
}

GTK is already a dependency for Viewnor, the only requirement is to get a GdkPixBuf reference of the shown image, which should be pretty easy. Official Gtk doc for clipboard

If nobody do it first, I may try to fill a merge request is the following days at is seems pretty simple.