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

Ability to copy image files to clipboard #705

Open
Juhan280 opened this issue Sep 2, 2024 · 7 comments
Open

Ability to copy image files to clipboard #705

Juhan280 opened this issue Sep 2, 2024 · 7 comments

Comments

@Juhan280
Copy link

Juhan280 commented Sep 2, 2024

Feature description
termux-clipboard-set can copy text into clipboard. But if we pass an image file, nothing happens.

I would like to be able to copy image files into android clipboard.

Reference implementation

All the major browsers can copy image to clipboard.
Screenshot_20240903-012028_Brave

@ajay-vishnu
Copy link

Is anyone working in this issue?

@tathastu871
Copy link

Browsers allows you to copy images but can you tell where do you paste these images

@ajay-vishnu
Copy link

ajay-vishnu commented Oct 14, 2024

In the DMs mainly and other things that I can't think of from the top of my head.

@tathastu871
Copy link

Convert Bitmap to blob
Get contentUri to blob
use clipData.newUri

@Juhan280
Copy link
Author

Convert Bitmap to blob
Get contentUri to blob
use clipData.newUri

Sorry, I don't quite understand this. Can you explain it a bit further or point me to somewhere i can read more?

@tathastu871
Copy link

tathastu871 commented Oct 23, 2024

@Grimler91
Cant you add support for clipboatdManger setNew Uri
content provider from termux shared fails

Need to converr images to

content://media/external/images/media/171412

and then setUri on clipboard

Theres is app called com.slash.clipboard on play stotr that can copy images
it had copy activity that can be trigger using intent but it cannot handle fails fot termux content provider

If using files app i select share image and intercept intent and get content://media/external/images/media/171412

then
from termux
am start -n content://media/external/images/media/171412

am start -n com.slash.clipboard/com.slash.clipboard.CopyActivity -a android.intent.action.SEND -t image/* --eu android.intent.extra.STREAM content://media/external/images/media/171412 It does work to copy image to clipbaord

But file provider from termux content://com.termux.sharedfiles/storage/emulated/0/DCIM/Camera/20241021_204401.jpgapp cannot handle these and fails

@tathastu871
Copy link

Convert Bitmap to blob
Get contentUri to blob
use clipData.newUri

Sorry, I don't quite understand this. Can you explain it a bit further or point me to somewhere i can read more?

That requires java code for modification in libtermux api file

Till Them best you can do is
install termuxGUI plugin and its python dependencu

its utility called termux-gui-view image.jpg
it opens images in floating popup that you can fullscreen and also it automatically closes after 3or5 seconds
within that you screenshot
and on samsing phones and many other screenshoting adds images to keybord clipboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants