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 quality loss #2961

Open
andriykrefer opened this issue Feb 6, 2025 · 9 comments
Open

Image quality loss #2961

andriykrefer opened this issue Feb 6, 2025 · 9 comments

Comments

@andriykrefer
Copy link

Describe the bug

When copying a image from a word document and pasting in another document, the image quality is not the same as the original, it is way lower.

To Reproduce

  • Copy a image from a MS Word document
  • Paste in another document with the default windows clipboard (ctrl+v). The image quality will be the same
  • Paste in another document with CopyQ. The image will be blurry and low quality

Expected behavior

  • Keep the same image as the original

Screenshots

  • Default CTRL+V on the left, CopyQ on the right
    Image

Version, OS and Environment

  • 8.0.0
  • Windows 10

Additional context

@hluk
Copy link
Owner

hluk commented Feb 7, 2025

Can try with the latest version of CopyQ?

Can you also check the formats of the copied image data in the system clipboard (from the main window menu bar: File - Show Clipboard Content) and content of the item in CopyQ (menu bar: Item - Show Content)?

@andriykrefer
Copy link
Author

Hi, I did not had time to test on the latest version before. Now I tested in v9.1.0 and the behavior still the same.

The Clipboard Content has two items, the first with the original quality and the second one with the lower quality.

Image

@hluk hluk removed the bug label Feb 16, 2025
@hluk
Copy link
Owner

hluk commented Feb 16, 2025

The app prefers rendering PNG because it is simpler to render than SVG. It shouldn't affect the image quality by itself (unless there is a bug in Qt framework), it uses the PNG data from the system clipboard (source application).

As a workaround, you can add the following command to CopyQ so it stores only SVG image data next time it is copied (here is how to add the command to CopyQ):

[Command]
Automatic=true
Command="
    copyq:
    const svgFormat = 'image/svg+xml';
    for (const format of dataFormats()) {
        if (format.startsWith('image/') && format !== svgFormat) {
            removeData(format);
        }
    }"
Icon=
Input=image/svg+xml
Name=Store Only SVG

@andriykrefer
Copy link
Author

Thanks @hluk, but the SVG is the lower quality one, and I would want to remove that one. Additionally, It seems to be possible to restrict this script to a specific Window. Could show me how to do that? So it would apply only in MS Word. This script will run after copy or before paste?

@hluk
Copy link
Owner

hluk commented Feb 16, 2025

but the SVG is the lower quality one

Hmm, that is strange, unless there is some option in SVG making it low-res or there is really a bug in Qt.

Anyway, to avoid storing SVG in case there is a PNG format, use the following command instead:

[Command]
Automatic=true
Command="
    copyq:
    removeData('image/svg+xml');"
Icon=
Input=image/png
Name=Avoid Storing SVG

@hluk
Copy link
Owner

hluk commented Feb 16, 2025

This script will run after copy or before paste?

The command is triggered after copy (whenever system clipboard changes).

@andriykrefer
Copy link
Author

Hmm, that is strange, unless there is some option in SVG making it low-res or there is really a bug in Qt.

I suppose MS Word is putting these 2 items in the clipboard when I copy, since word documents are basically xml. But the Windows "paste" chooses the png file, and copyq is choosing the xml by default

@andriykrefer
Copy link
Author

Is it possible to trigger this command only when working with Ms Word?

@hluk
Copy link
Owner

hluk commented Feb 17, 2025

Yes, if you can provide a text from the title of the window where you copy the image:

  1. Open Commands dialog (F6 shortcut).
  2. Select the "Avoid Storing SVG".
  3. Make sure the "Show Advanced" checkbox in the lower right corner is enabled.
  4. Click on the "Advanced" tab.
  5. Set "Window" text field to a part of the window title.
  6. Click OK dialog button to apply changes.

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

2 participants