youtube-screenshot
youtube-screenshot copied to clipboard
No option to select screenshot format when copying to clipboard
The option to change screenshot format appears for me when saving images but disappears when copying to clipboard.
Hi @mfsoup. You're right, PNG format is forced by design when copying to clipboard. I don't know if it can work with JPEG format. When do you need clipboard image to be JPEG?
In my experience, the difference between JPEG and PNG on Youtube screenshots is nearly imperceptible while one is 1/5th the size. For example, these two images were taken through the extension: https://files.catbox.moe/ubq717.png https://files.catbox.moe/ua5rpw.jpeg
The difference in size can be noticeable when pasting to Discord or something on slow or unstable internet connections.
The clipboard.setImageData() API used in Firefox to copy the image in clipboard supports PNG and JPEG format.
@mfsoup, I have done some tests in a dedicated branch here. It seems to work. However, in my macOS environment, whatever the selected image format, the saved data in the native clipboard seems to be a TIFF one. Let me know if you can test it and determine if it could be useful for others OS (Windows, Linux).
@mfsoup, I have done some tests in a dedicated branch here. It seems to work.
Hey, I tried this branch of yours on Linux. I'm able to select the JPEG format with copy to clipboard but the output screenshot is still of png type.
@himanshugoswamiii, thanks for your tests. Could you please describe a bit your environment and how you check the MIME type in clipboard please?
@joggee-fr , I'm currently running
OS: Endeavouros
Linux Kernel: 6.1.37-1-lts
Firefox Version: 114.0.2 (64-bit)
I checked the mime type by pasting the image to my desktop. It showed the extension as png
, the image size is around 700Kb as well, while when downloading the image extension is jpeg and size is around 90Kb
@himanshugoswamiii
Are you using a Wayland-based environment? If so, could you try the command wl-paste -l
(available from wl-clipboard
package) after copying the screenshot in expected JPEG format?
Maybe you could also add some traces using console.log()
in background.js to check the type parameter passed to setImageData()
and check it with Firefox devtools. To do so in Firefox, type about:debugging
for the URL address. Then, go to "This Firefox" section. In the "Temporary add-ons" list, reload the patched branch and use "Inspect" button to load devtools.
Side note, my test branch were based on previous release and you MUST refresh the YouTube page for the configuration change to be applied.
Sorry, I don't have a full Linux environment right now to test it myself. Would be interesting to test it with Windows also as its clipboard is expected to support JPEG and PNG (Windows Clipboard Formats).
@gurumukhi, @mfsoup What is your testing environment?
I am using Mac.
Hey @joggee-fr, I think the problem is how copied image are being handled in my OS. So i noticed whenever i copy an image from web whether it's jpeg or png it gets copied as png only.
It happens from the web only Btw i have a workaround for this. KDE Plasma allows me to select Mime type when pasting
I will inform if i found the issue. If someone is using windows they can check if this behavior occurs there as well
This post is also telling the same thing with chrome https://forum.obsidian.md/t/pasted-images-convert-to-jpg-instead-of-png/11100/4
@mfsoup, I have done some tests in a dedicated branch here. It seems to work. However, in my macOS environment, whatever the selected image format, the saved data in the native clipboard seems to be a TIFF one. Let me know if you can test it and determine if it could be useful for others OS (Windows, Linux).
Sorry for the late reply but the build still copies as png for me as well. Latest Windows 10 running Firefox 116.0
This issue seems very OS-dependent and I feel like there is not a reliable solution to force the MIME type in the clipboard.