Skip to content
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

export to clipboard #11558

Closed
bart9h opened this issue Apr 17, 2022 · 10 comments
Closed

export to clipboard #11558

bart9h opened this issue Apr 17, 2022 · 10 comments

Comments

@bart9h
Copy link

bart9h commented Apr 17, 2022

please add a "Clipboard" as a target storage option to the export module.

should be easy possible to implement, and would be useful when exporting a single image to share or post somewhere.

@github-actions
Copy link

This issue did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

@dterrahe
Copy link
Member

should be easy to implement

What is this judgement based on? My (intentionally) limited understanding of clipboard functionality is that it can be complicated to support in a portable way. Usually for large data, like images, an application will notify the clipboard that data is available, but then has to keep it around until it is actually requested. So there is a "buffering" requirement that we don't have elsewhere. Then an image format that is supported by the "pasting" application needs to be made available. We could try to support just one greatest common denominator, but that might lose image quality, or a high quality one, but then some simple applications might not be able to accept it. So likely we'll need to support a range of formats.

Not saying this is not doable, but calling it trivial is not necessarily the best way to invite somebody to spend a significant amount of time learning about this stuff and then testing and bug fixing. Especially because those bugs will come from users who are likely to blame dt rather than some random 3rd party app they've been using for years without any problems.

@bart9h
Copy link
Author

bart9h commented Oct 31, 2022

I understand your points, this can get complicated.

We could limit to that common denominator, at a lower resolution.
If a large high-quality image is desirable, than the user should export to a file instead.

Maybe label the clipboard export option clearly to avoid confusion: on the "target" list it could be named "Clipboard (low res)" or something like that, and disable some other export settings (format, size, etc).

@dterrahe
Copy link
Member

It would not necessarily be a "low res" version (you could still specify the resolution in the export dialog); it would maybe (I don't know; haven't looked into whether a common denominator exists and what limitations it would have) be a not properly color managed version, or even have to have very low bit-depth. It might be so bad (but in unpredictable ways) that nobody would bother using it.

We could limit to that common denominator

Somebody who'd be willing to spend the time on this could definitely do that. You'd have to find a volunteer. And telling them this will be easy is not necessarily the best way to do that.

@bart9h
Copy link
Author

bart9h commented Oct 31, 2022

ok, I take that back :)

@github-actions
Copy link

This issue did not get any activity in the past 60 days and will be closed in 365 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

@owenjm
Copy link

owenjm commented Jan 31, 2023

Unsure why this hasn't been added already, but it really is trivial to implement as a lua script (under *nix, at least):

darktable = require "darktable"

darktable.preferences.register("clipboard_export","clip_options",
  "string","Clipboard command options",
  "Options for the clipboard CLI tool","-selection clipboard -t image/jpeg -i")

darktable.preferences.register("clipboard_export","clip_app",
  "string","Clipboard application",
  "CLI tool to copy images to the clipboard","xclip")
  
darktable.register_storage("clipboad_export","clipboard",
  function( storage, image, format, filename,
     number, total, high_quality, extra_data)
    darktable.control.execute(darktable.preferences.read("clipboard_export",
         "clip_app","string").." "..darktable.preferences.read("clipboard_export",
         "clip_options","string").." "..filename)
    darktable.print_toast("Image copied to clipboard")
end)

If you're using Wayland rather than X11, you'll need to set a different clipboard application, and likely different options for that command: you can do this under Preferences -> lua options.

Note that the above script has no error or sanity checking for the preference options, so if it doesn't work, check the command name and options (and look for an error message on the CLI). It also doesn't delete the tmp file after creation at present.

(I'm also a little puzzled as to why this isn't a native function of darktable, since GTK provides simple, native clipboard handling (and the toolkit takes care of everything downstream -- unlike as suggested by the poster above, dt would not have to handle image data after the clipboard set event). It seems a fairly useful option to provide? But thankfully the lua scripting extensibility makes it easy to work around.)

@dterrahe
Copy link
Member

I'm also a little puzzled as to why this isn't a native function of darktable

This isn't a complicated puzzle. It takes somebody with knowledge in this particular area, like apparently yourself, to pick this up and implement it. I'm sometimes a little puzzled by the need to explain how free software works.

@github-actions
Copy link

github-actions bot commented Apr 3, 2023

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

Copy link

This issue was closed because it has been inactive for 300 days since being marked as stale. Please check if the newest release or nightly build has it fixed. Please, create a new issue if the issue is not fixed.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants