leanflutter / screen_capturer

This plugin allows Flutter desktop apps to capture screenshots.
MIT License
83 stars 32 forks source link

store in variable without saving to disk #5

Closed ashwin31 closed 1 year ago

ashwin31 commented 2 years ago

Is it possible to store in variable without saving to disk?

like the following?

import 'package:screen_capturer/screen_capturer.dart';

CapturedData? capturedData = await screenCapturer.capture(
  mode: CaptureMode.screen
);
ashwin31 commented 2 years ago

Hi @lijy91 can you guide me how to do this?

lijy91 commented 2 years ago

All three platforms support saving to the clipboard after taking a screenshot. In theory, you only need to read the picture from the clipboard after the screenshot is successful.

ashwin31 commented 2 years ago

Thank you but the path is mandatory in the capture function. so, the file is being saved in the imagePath. Can you please make the imagePath parameter as optional.

Norman-w commented 1 year ago

Is it possible to store in variable without saving to disk?

like the following?

import 'package:screen_capturer/screen_capturer.dart';

CapturedData? capturedData = await screenCapturer.capture(
  mode: CaptureMode.screen
);

Please review: This PR

mathewthe2 commented 1 year ago

Please review: This PR

The modified code does not support Mac or Linux. Please consider retaining compatibility with existing code on current platforms.

lijy91 commented 1 year ago

It will be supported in the next version, examples are as follows:

await screenCapturer.capture(
  mode: CaptureMode.region,
  copyToClipboard: true,
);
mathewthe2 commented 1 year ago

Is there a way to just capture the image data without using the clipboard?

lijy91 commented 1 year ago

Please update to 0.1.5

lijy91 commented 1 year ago

Is there a way to just capture the image data without using the clipboard?

The clipboard must be used now, but the image data can be obtained through CapturedData.imageBytes.

mathewthe2 commented 1 year ago

Can you at least share the issues that are preventing such an implementation? I've worked with screen capture libraries on Mac before without having to go through the clipboard or the file system, so if it's a Mac issue I could contribute.