Git Product home page Git Product logo

Comments (1)

palxiao avatar palxiao commented on June 9, 2024

html2canvas 的原理是通过 JS 解析目标 DOMTree 然后“翻译”成 Canvas 语法绘制,借由 Canvas API 出图。有几个明显缺点,比如绘制成 Canvas 后图片可能会失真(锯齿、模糊等情况),比如有很多 CSS 特性不支持(如渐变色、文字特效等需要额外开发),还有画布中使用了 SVG 等元素解析困难,所以前端出图在应对复杂场景时工作量难以预估,只有在特别简单的场景下:例如只有图片和最简单的文字构成的海报可以考虑从前端直接出图。服务端 Chrome 截图方式没有这种”翻译“的过程,相当于直接将浏览器作为渲染引擎,能在最少开发成本下保证出图准确性和质量。

其它:稿定设计出图方案参考

from poster-design.

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.