Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
How to copy pictures to clipboard
How to copy pictures to clipboard
How to copy pictures to clipboard
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to copy pictures to clipboard
Hi,
Call TChromium.DownloadImage to download the image and implement the TChromium.OnDownloadImageFinished event to get the image data.
Then you only need to call TCefImageRef.GetAsBitmap to get the binary data and copy it to the clipboard.
The MiniBrowser demo uses TChromium.DownloadImage to download a sample image.
Call TChromium.DownloadImage to download the image and implement the TChromium.OnDownloadImageFinished event to get the image data.
Then you only need to call TCefImageRef.GetAsBitmap to get the binary data and copy it to the clipboard.
The MiniBrowser demo uses TChromium.DownloadImage to download a sample image.
Re: How to copy pictures to clipboard
I mean: copy the picture from the right-click menu
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to copy pictures to clipboard
You can add a custom context menu option called "Copy image to clipboard" that downloads the image and copies the image data to the clipboard.
See the MiniBrowser demo to know how to add a custom context menu option.
See the MiniBrowser demo to know how to add a custom context menu option.
Re: How to copy pictures to clipboard
TempBinValue :=image.GetAsBitmap(1,CEF_COLOR_TYPE_RGBA_8888, CEF_ALPHA_TYPE_OPAQUE, TempWidth, TempHeight );salvadordf wrote: Wed May 06, 2020 9:03 am Hi,
Call TChromium.DownloadImage to download the image and implement the TChromium.OnDownloadImageFinished event to get the image data.
Then you only need to call TCefImageRef.GetAsBitmap to get the binary data and copy it to the clipboard.
The MiniBrowser demo uses TChromium.DownloadImage to download a sample image.
TempBinValue :=image.GetAsBitmap(1,aTempTCefColorType ,aTempTCefAlphaType, TempWidth, TempHeight );
all of these cannot work.
image.GetAsJpeg(1,0, TempWidth, TempHeight); the quality is very poor!
The sample didn't have code for TCefImageRef.GetAsBitmap and copy it to the clipboard,
May you write some example code, thank you very much!
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to copy pictures to clipboard
Use TChromiumCore.StartDownload with the image url and save it to a temporary directory.
That way you will have the original image without any quality loss due to compression.
That way you will have the original image without any quality loss due to compression.
Re: How to copy pictures to clipboard
Is this the only way? It may be possible to downto a stream then copy to clipbord?salvadordf wrote: Thu Nov 21, 2024 11:20 am Use TChromiumCore.StartDownload with the image url and save it to a temporary directory.
That way you will have the original image without any quality loss due to compression.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: How to copy pictures to clipboard
There are several ways to get the images but this is the easiest method and it also gives the best image quality.
Re: How to copy pictures to clipboard
Thank you very much!
Re: How to copy pictures to clipboard
But how to download this?
img data="" src="data:image/jpg;base64
img data="" src="data:image/jpg;base64