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 resoultion for saving image . #30

Open
ganeshchenniah opened this issue Oct 3, 2020 · 3 comments
Open

Image resoultion for saving image . #30

ganeshchenniah opened this issue Oct 3, 2020 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ganeshchenniah
Copy link

  1. When the signature is drawn on canvas , resolution is good , when the right mark is clicked , the resolution of the png goes bad . 2. When stroke width is 5, i can see crack in signature
@MartinHlavna
Copy link
Member

Looks like there is issue with Picture.toImage() rendering. I was not able to fix it at the moment.

This issue sugests accomodating device pixel ratio into calculation but that was not helping in our case.

@MartinHlavna MartinHlavna added help wanted Extra attention is needed bug Something isn't working labels Feb 23, 2021
@cs-nuuk
Copy link

cs-nuuk commented Feb 2, 2022

If anyone is looking for a workaround. You can do something like this with the pixel ratio MartinHlavna mentioned to get a higher resolution.

import 'dart:ui' as ui;
class _SignaturePageState extends State<SignaturePage> {
  GlobalKey globalKey = GlobalKey();
RepaintBoundary(
    key: globalKey,
    child: Signature(
        controller: _controller,
        backgroundColor: Colors.white,
    ),
);
IconButton(
    icon: const Icon(Icons.check),
    color: Colors.blue,
    onPressed: () async {
        final RenderRepaintBoundary? boundary = globalKey.currentContext?.findRenderObject() as RenderRepaintBoundary?;
        ui.Image? image = await boundary?.toImage(pixelRatio: 3);
        ByteData? byteData = await image?.toByteData(format: ui.ImageByteFormat.png);
        Uint8List? pngBytes = byteData?.buffer.asUint8List();
        
        if (pngBytes != null) {
            await Navigator.of(context).push(
                MaterialPageRoute<void>(
                    builder: (BuildContext context) {
                        return Scaffold(
                            appBar: AppBar(),
                            body: Center(
                                child: Image.memory(pngBytes),
                            ),
                        );
                    },
                ),
            );
        }
    },
),

@carlos00027
Copy link

how send http multipart request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants