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

Image is cutoff / cropped #6

Closed
jdonofrio728 opened this issue Jan 27, 2020 · 17 comments · Fixed by #15
Closed

Image is cutoff / cropped #6

jdonofrio728 opened this issue Jan 27, 2020 · 17 comments · Fixed by #15

Comments

@jdonofrio728
Copy link

jdonofrio728 commented Jan 27, 2020

I've recently discovered this tool and implemented it into my daily workflow. However for some reason the images when copied to clipboard or saved are cut off or zoomed in. Here is an example

This picture is a screen shot straight from grim into wl-copy
image

This is the "same" screen shot which goes into swappy then into my clipboard:
image

I'm running sway 1.0 with wlroots 0.10.0 (latest on arch)

Let me know if there is anything else that you may need to debug!

@jtheoof
Copy link
Owner

jtheoof commented Jan 31, 2020

@jdonofrio728 it seems you are using the -g option of swappy which is not as solid as its grim counterpart. It needs more love. Can you try the -f option and use swappy as a pipe from grim output (See README).

Let me know if it fixes the issue for you.

@jdonofrio728
Copy link
Author

jdonofrio728 commented Jan 31, 2020

Hey @jtheoof thanks for the response. The actual command that is being executed by sway is
grim -g "$(slurp)" - | swappy -f -

This is the first example from the README. So the -g option from swappy is not in play here. Something else seems to be problematic :(

@jtheoof
Copy link
Owner

jtheoof commented Feb 1, 2020

You're right, my bad I read too fast.

Let me see if I can figure out what's going on.

@jdonofrio728
Copy link
Author

@jtheoof I did a little experiment this morning, and I think the issue might be around the fact that my displays are scaled. I have a 4k display scaled to 2. If I reduce the scaling to 1, then the screen shot copies correctly.

@jtheoof
Copy link
Owner

jtheoof commented Feb 1, 2020

OK I'm gonna try to reproduce it. How do you scale the display with sway?

@jdonofrio728
Copy link
Author

Grab your outputs by running
swaymsg -t get_outputs

Then set the scale by running (eDP-1 is my screen):
swaymsg output eDP-1 scale 2

@jtheoof
Copy link
Owner

jtheoof commented Feb 18, 2020

I have not forgot about you @jdonofrio728.
I can easily reproduce the issue with the scaling config but this fix requires more work than I expected. I need to update the logic when the window is created. And I really have no expertise in GTK land and its layout management. I'll tackle this when I have more free time.

jtheoof added a commit that referenced this issue May 18, 2020
Compute the size of the GTK window based on sane compute that works well
for single monitor. Still not sure how this behaves on multi monitors.

Closes #6
jtheoof added a commit that referenced this issue May 18, 2020
Compute the size of the GTK window based on sane compute that works well
for single monitor. Still not sure how this behaves on multi monitors.

This also fixes the issue where swappy would crop the image on scaled
output displays.

Closes #6
jtheoof added a commit that referenced this issue May 18, 2020
Compute the size of the GTK window based on sane compute that works well
for single monitor. Still not sure how this behaves on multi monitors.

This also fixes the issue where swappy would crop the image on scaled
output displays.

Closes #6
@jtheoof
Copy link
Owner

jtheoof commented May 18, 2020

Hi @jdonofrio728, the issue should now be fixed with latest swappy.

@maximbaz
Copy link

Hi @jtheoof , I can still reproduce this issue on the latest master. My scale is 2.5, swappy crops the image when the scale is set to 2 as well, only if I set it to 1 then the image is copied fully.

@jtheoof
Copy link
Owner

jtheoof commented May 23, 2020

@maximbaz Are you using swappy with the -g or the -f option?

@maximbaz
Copy link

swappy -f area.png, full script here

@maximbaz
Copy link

If you want I can try to get you some debug info from my system, if you want me to try a development branch with a bunch of printfs I would be up for that too, whatever helps :)

@jdonofrio728
Copy link
Author

jdonofrio728 commented May 23, 2020

@jtheoof I can also validate that the issue is not fixed. The preview window shows the screen shot correctly. But when you copy it to your clipboard and paste it somewhere, it is cropped.

@jtheoof
Copy link
Owner

jtheoof commented May 23, 2020

Oh I see. My bad, I'll reopen this issue.

@jtheoof jtheoof reopened this May 23, 2020
jtheoof added a commit that referenced this issue May 23, 2020
This fixes the scaling issue when user would copy or save the file.

Commit `445980b` only solved the rendering part not the pixbuf part.

Closes #6
jtheoof added a commit that referenced this issue May 23, 2020
This fixes the scaling issue when user would copy or save the file.

Commit `445980b` only solved the rendering part not the pixbuf part.

Closes #6
@jtheoof
Copy link
Owner

jtheoof commented May 23, 2020

@jdonofrio728 @maximbaz I fixed the pixbuf issue with scaling. Now the both the rendering and copy/save logic should work no matter the scale. Let me know if you still have issues.

@maximbaz
Copy link

It works! Thank you so much 🎉

@jdonofrio728
Copy link
Author

@jtheoof definitely working! Thank you!

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

Successfully merging a pull request may close this issue.

3 participants