Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Int16  
#1 Posted : 17 October 2020 15:21:32(UTC)
Int16

Rank: Newbie

Groups: Registered
Joined: 15/10/2020(UTC)
Posts: 9

I can drag an image from File Manager to SMath but I can't paste a copied image from clipboard to SMath.

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Eric Myers  
#2 Posted : 17 October 2020 17:26:34(UTC)
Eric Myers


Rank: Advanced Member

Groups: Registered
Joined: 03/10/2018(UTC)
Posts: 33
United States

Was thanked: 4 time(s) in 4 post(s)
I made a tool to help me with this. It's pretty clunky and will be a little embarassing to share, but it is useful. I'll put it on github, hopefully later today.
Offline Eric Myers  
#3 Posted : 18 October 2020 06:10:23(UTC)
Eric Myers


Rank: Advanced Member

Groups: Registered
Joined: 03/10/2018(UTC)
Posts: 33
United States

Was thanked: 4 time(s) in 4 post(s)
The code for the tool is uploaded to github now. It's a screengrabber-type tool rather than doing anything with what's already on the clipboard. Hopefully it will be helpful.

What I faced when trying to insert images from a file on disk was that they would be invisible then next time I opened the SMath sheet. They've done okay for me when using this method though.

https://github.com/erict...rs/insert_image_to_smath
Offline sinneD  
#4 Posted : 18 October 2020 08:29:41(UTC)
sinneD


Rank: Advanced Member

Groups: Registered
Joined: 12/03/2011(UTC)
Posts: 101
Location: Chicago

Was thanked: 16 time(s) in 7 post(s)
that's pretty sweet!

i will try it with devuan and see how it works.

what anaysis program is that in Linux that you are using?
Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Andrey Ivashov  
#5 Posted : 18 October 2020 10:39:06(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Spent some time on it under debugger but it seems I cannot do anything here.

Image copied from another app is just not visible under Mono. Ok with a text, but not with images.

I can imaging to integrate some Linux specific script (python or something else) which will get image from Clipboard and put it somewhere on the disk as a file, so SMath Studio could import that file. If it will be automated then it will be transparent to the user.

Best regards.
Offline overlord  
#6 Posted : 18 October 2020 16:59:05(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,124
Turkey

Was thanked: 506 time(s) in 337 post(s)
Originally Posted by: Andrey Ivashov Go to Quoted Post
Spent some time on it under debugger but it seems I cannot do anything here.

Image copied from another app is just not visible under Mono. Ok with a text, but not with images.

I can imaging to integrate some Linux specific script (python or something else) which will get image from Clipboard and put it somewhere on the disk as a file, so SMath Studio could import that file. If it will be automated then it will be transparent to the user.

Best regards.

I guess this is not a bug. Linux has different handling with image clipboard afaik.
One of basic paint program I use (mtpaint) has this issue too.
First you need to "import" linux clipboard into mtpaint clipboard with a menu button. Then you can paste image into mtpaint.
Or if you want to copy an image from mtpaint to system clipboard you have to "export" it to system clipboard via a button.
What I want to say is maybe this script could work. But I think this is not a bug, functionality approach of linux.

Regards.
thanks 1 user thanked overlord for this useful post.
on 18/10/2020(UTC)
Offline Eric Myers  
#7 Posted : 18 October 2020 20:08:02(UTC)
Eric Myers


Rank: Advanced Member

Groups: Registered
Joined: 03/10/2018(UTC)
Posts: 33
United States

Was thanked: 4 time(s) in 4 post(s)
Originally Posted by: sinneD Go to Quoted Post
that's pretty sweet!

i will try it with devuan and see how it works.

what anaysis program is that in Linux that you are using?


The analysis is from a python FEA library called PyNite, installable via pip.

If anyone has checked out the utility and found it usable, be advised that I'll update it soon to do away with the need to copy and paste into a text editor. That is a relic of how an earlier version was written, but can be simplified now. I'll post back here when it's ready.
Offline Eric Myers  
#8 Posted : 19 October 2020 22:44:19(UTC)
Eric Myers


Rank: Advanced Member

Groups: Registered
Joined: 03/10/2018(UTC)
Posts: 33
United States

Was thanked: 4 time(s) in 4 post(s)
Okay, the new version of the tool is released at https://github.com/erictmyers/insert_image_to_smath.

Screenshot.png

There is a warning in the README, but I'll add it here as well- the tool writes directly to the selected SMath files. I haven't had any problems with that yet but testing has been minimal, so please make backups before clicking the Insert Image button.

Best regards, I hope you'll find it helpful!

Edited by user 21 December 2020 01:33:43(UTC)  | Reason: Not specified

thanks 1 user thanked Eric Myers for this useful post.
on 20/10/2020(UTC)
Offline Jean Giraud  
#9 Posted : 20 October 2020 03:02:16(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Why insert such a big area ?
Capture/select/crop save [as *.PNG]

Insert Planet.PNG
Offline overlord  
#10 Posted : 20 October 2020 04:34:03(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,124
Turkey

Was thanked: 506 time(s) in 337 post(s)
Another method which is very simple and a little tricky. You will need "xclip" for this, a small X program.
Xclip is maybe already installed or you will need get it from your favorite linux distribution's repo.
Also there should be an image on clipboard. (obviously)
Not very elegant but you can extract clipboard to a file easily and drag it into SMath.

1 - Open the terminal, enter the command;
xclip -selection clipboard -t image/png -o > example.png
This will create a picture file from clipboard which is named "example.png" in terminal directory.
2 - Drag the file directly to smath.

That's it.

Edit: Sometimes SMath doesn't fully get base64 data of dragged file to picture region.
Image region can get full base64 data if you right click and import the file.
Need more investigation.

Edited by user 20 October 2020 05:33:46(UTC)  | Reason: Not specified

Offline Eric Myers  
#11 Posted : 20 October 2020 23:54:40(UTC)
Eric Myers


Rank: Advanced Member

Groups: Registered
Joined: 03/10/2018(UTC)
Posts: 33
United States

Was thanked: 4 time(s) in 4 post(s)
Another updated version is available at https://github.com/erictmyers/insert_image_to_smath. It features a much nicer (resizable and movable) area selection, and is cross platform for what that's worth. It requires a newish version of PyQt and Qt (5.10 or higher)

This is the last tweak I plan for now.

Screenshot.png

Edited by user 21 December 2020 01:32:56(UTC)  | Reason: Not specified

Offline Jean Giraud  
#12 Posted : 21 October 2020 02:08:10(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Eric Myers Go to Quoted Post
This is the last tweak I plan for now.

Can you just have 10 kB *.PNG instead of 1.3 MB Monster Big ?

Pipe.PNG

Offline Eric Myers  
#13 Posted : 21 October 2020 02:24:57(UTC)
Eric Myers


Rank: Advanced Member

Groups: Registered
Joined: 03/10/2018(UTC)
Posts: 33
United States

Was thanked: 4 time(s) in 4 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: Eric Myers Go to Quoted Post
This is the last tweak I plan for now.

Can you just have 10 kB *.PNG instead of 1.3 MB Monster Big ?



My apologies, I may have been insensitive to bandwidth issues. Hopefully the file size hasn't caused too much trouble for anyone, I'll try to do better in future posts.

Best regards,
Eric
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.