Coder Social home page Coder Social logo

Comments (10)

qq15725 avatar qq15725 commented on September 26, 2024 1

Are there still problems with svg+xml inline image decoding in Safari? The simple example I tested seems to be normal

modern-screenshot: 4.4.15

https://codepen.io/qq15725/pen/PoBbOWm

image

You need to see how the font is imported. Is there a warning of CORS

from modern-screenshot.

Funncy avatar Funncy commented on September 26, 2024

And in Safari, it takes three calls to domToCanvas to upload the image correctly

First
download-11

Second
download-12

Thrid
download-13

from modern-screenshot.

Funncy avatar Funncy commented on September 26, 2024

Thanks for the quick reply.
The issue of calling and saving the image multiple times is not a pressing issue for me at the moment - the library is fast enough for me to call it 3 times. (I'll try to reproduce the symptoms with codepen or something later).

The more pressing issue for me is
I'm currently developing a webapp made with Nextjs and wrapped in Flutter.
I'm using native webviews.
On the iPhone mobile webview, when I apply scale, it doesn't work and I get a degraded quality. Same thing when I give quality to 1.
I have to save it in high quality now.
Could you please give me some whiteness in this regard?

from modern-screenshot.

Funncy avatar Funncy commented on September 26, 2024

Oh and by the way, the font is fixed, thanks.

from modern-screenshot.

qq15725 avatar qq15725 commented on September 26, 2024

image

then

canvas.toDataURL('image/png', 1)

canvas should only export png like this

from modern-screenshot.

qq15725 avatar qq15725 commented on September 26, 2024

The canvas default dpi is 96 which is probably your problem

from modern-screenshot.

Funncy avatar Funncy commented on September 26, 2024
const canvas = await domToCanvas(node, {
      scale: 3,
      backgroundColor: 'white',
      drawImageInterval: 1000,
      quality: 1,
    });

    if (checkWebApp()) {
      const result = await saveImageToGallery(canvas.toDataURL('image/png', 1));
      if (result === undefined) {
        setToast({
          content: '오류가 발생했습니다.',
        });
        return;
      }

      setToast({
        content: '저장되었습니다.',
      });
      return;
    } else {
      FileSaver(canvas.toDataURL('image/png', 1));
    }

Above is my code.

scale doesn't work on mobile webview
It works fine in desktop safari.

from modern-screenshot.

Funncy avatar Funncy commented on September 26, 2024

As I continue to test, the issue with degradation seems to be more about quality than scale.

It only happens on the iPhone mobile webview.

from modern-screenshot.

qq15725 avatar qq15725 commented on September 26, 2024

You can also try domToPng, I will handle png dpi value based on scale

origin width: 1280
origin height: 105.5
scale: 4

output width: 5120
output height: 422
dpi: 384

image

from modern-screenshot.

Funncy avatar Funncy commented on September 26, 2024

Thank you, strangely it looks degraded in the iPhone gallery but when I put it on Instagram it looks fine. thank you!!!

from modern-screenshot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.