V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ksc010
V2EX  ›  问与答

phantomjs 截图网页高度超过 30,000px 输出的图片显示不全,有人知道怎么解决么?

  •  
  •   ksc010 · 2014-05-22 16:06:42 +08:00 · 5033 次点击
    这是一个创建于 3652 天前的主题,其中的信息可能已经有所发展或是发生改变。
    https://github.com/ariya/phantomjs
    这个应该是phantomjs的bug 具体情况是 超过3万多像素 截图输出jpg 超过部分是黑色的
    若是png超过部分是透明的

    @larryzhao 也提交issue了 (今天给你发了封邮件不知道看到没)
    https://github.com/ariya/phantomjs/issues/11934

    这个问题貌似是fix了 但是不知道为什么还是出现 1049
    https://github.com/ariya/phantomjs/blob/master/src/webpage.cpp
    // We use tiling approach to work-around Qt software rasterizer bug
    // when dealing with very large paint device.
    // See http://code.google.com/p/phantomjs/issues/detail?id=54.
    const int tileSize = 4096;
    int htiles = (buffer.width() + tileSize - 1) / tileSize;
    int vtiles = (buffer.height() + tileSize - 1) / tileSize;
    for (int x = 0; x < htiles; ++x) {
    for (int y = 0; y < vtiles; ++y) {

    **Rendering PNGs hangs on some sites while PDF works great.**
    http://code.google.com/p/phantomjs/issues/detail?id=54

    https://github.com/ariya/phantomjs/commit/e7ca6c0a
    1 条回复    2014-05-22 16:23:54 +08:00
    ksc010
        1
    ksc010  
    OP
       2014-05-22 16:23:54 +08:00
    phantomjs 这个是c++写的
    !-- 目前不想在研究一门新语言了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2557 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 15:04 · PVG 23:04 · LAX 08:04 · JFK 11:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.