Parameterise useScreenshot for alternate file types e.g. jpg
CraigChamberlain opened this issue · 5 comments
CraigChamberlain commented
It might be useful to download a filetype other than png for example .jpg.
It shouldn't be too hard to achieve and could be an optional "options object"
At point of consumption:
const [image, takeScreenShot] = useScreenshot({ type: 'image/jpeg', quality: 1.0 });
In the source code:
const base64Image = croppedCanvas.toDataURL(type, quality)
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL
vre2h commented
Hi Craig, hope you're doing great.
I somehow didn't see your issue and PR. Let me check everything and get back to you.
Sorry for ignoring you one more time.
CraigChamberlain commented
No problem at all. I used a locally created package and more or less
forgot about it. Hope it makes it more versitile for otheres. Thanks for
merging. C
…On Wed, 10 Feb 2021 at 12:35, Vrezh Oganisyan ***@***.***> wrote:
Closed #1 <#1>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALRDEQYXN432MVPLRZ5FGKDS6J4SPANCNFSM4TBEFZJQ>
.
--
*Craig Chamberlain | **IT Services*
{tel: 07526825153}
{web: www.craigchamberlain.it}
slaymantis commented
Thanks for adding the jpg option into createFileName()
Is it possible to change the quality setting to reduce the file size of the JPEG?
CraigChamberlain commented
I think it is possible, just pass an object.
const [image, takeScreenShot] = useScreenshot({ type: 'image/jpeg',
quality: 1.0 });
…On Tue, 20 Apr 2021 at 05:55, slaymantis ***@***.***> wrote:
Thanks for adding the jpg option into createFileName()
Is it possible to change the quality setting to reduce the file size of
the JPEG?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALRDEQ5V6W3BOETRLABBVSLTJUCLTANCNFSM4TBEFZJQ>
.
--
*Craig Chamberlain | **IT Services*
{tel: 07526825153}
{web: www.craigchamberlain.it}