Git Product home page Git Product logo

gka's Issues

是不是mac环境下用不了?

image
image
如图,在生成的gka-icon-u-normal文件夹或gka-icon-u-canvas里,只有img文件夹,没有其他文件。
使用命令:
$gka ./icon -t

使用样例图片输出svg,比例失真

我在使用样例的一序列图片输出svg时, 打开看到动画失真
svg:
image
这个是css输出:
image
还有另一个问题 默认的svg模板 是输出svg文件出来吗?如果是的话 为什么在使用svg模板输出没有svg文件?
image

可以支持放出接口

现在是一个命令行工具,如果想在项目中用呢?比如希望有如下操作:

const gka = require('gka');

...

install warn

npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated [email protected]: Please use the native JSON object instead of JSON 3
/usr/local/bin/gka -> /usr/local/lib/node_modules/gka/bin/gka.js

生成多张合并图片

我有个需求,有260张连续图片,希望生成多张4*3的合并图。
目前,如果使用-s合并,只能生成一张270M的图片,没法使用

生成合图时遇到异常情况没有抛出实际的错误,导致无法排查问题

举个例子,当 png 图片的签名非法时,合图出错,但没有抛出实际的错误,继续执行 writeFileSync 的逻辑,最终抛出了 TypeError: Cannot read property 'image' of undefined 的异常,无法获悉具体的错误情况

目前的报错:

            fs.writeFileSync(filepath, r.image);
                                         ^
TypeError: Cannot read property 'image' of undefined
    at /Users/neal/Workspace/xxx/node_modules/[email protected]@gka/lib/plugins/ImageSpritesPlugin.js:24:42
    at /Users/neal/Workspace/xxx/node_modules/[email protected]@mkdirp/index.js:30:20
    at FSReqCallback.oncomplete (fs.js:148:20)

实际的错误为:

Error: Invalid file signature
    at module.exports.Parser._parseSignature (/Users/neal/Workspace/xxx/node_modules/[email protected]@pngjs/lib/parser.js:50:18)
    ...

一种解决方案:

// 在合图异常时,直接抛出 error
// ImageSpritePlugin.js:23
function gsprites(srcs, filepath, algorithm, callback) {
    Spritesmith.run({
        src: srcs,
        algorithm: algorithm,
        algorithmOpts: {sort: false},
    }, function(err, r) {
        if (err) throw err;
        mkdirp(path.dirname(filepath), function (err) {
            fs.writeFileSync(filepath, r.image);
            // console.log('[-] ' + path.basename(filepath) +' generated');
            callback && callback(r, filepath);
        });
    });
}

合成的图片过大

我有156张图片, 每张图片大小50kb,生成的图片100多m,使用的是 -u canvas ,应如何优化

能规定固定尺寸或者选择以最大图为尺寸吗

我想要的是这样的:

现在素材是这样的:

如果能固定一个每帧尺寸,图片居中,应该就能满足需求了。
如果选最大的图作为尺寸,也很方便。

当然,其实这样也不太好。
因为素材尺寸不一,它于画面中的居中可能结果并不是预期。
暂时没想到什么好办法。

图片首次闪烁

gka E:\img指令看生成的代码虽然有做图片预加载,但是在css里面animatio引用还是直接引用的本地的,和没有预处理差不多

在使用图片压缩的时候报错的了

我在使用图片压缩的时候报错如下:

C:\WINDOWS\system32>gka -t C:\Users\xxx\Pictures\tinified
gka version:1.4.6

  • optimizing image..
    dir: C:\Users\xxx\Pictures\tinified
    [ 'C:\Users\xxx\Pictures\tinified' ]
    (node:11740) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 44): Error: Error in file: C:/Users/xxx/Pictures/tinified/0002.png
    ϵͳ�Ҳ���ָ����·����
    (node:11740) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

node版本为V8.1.3,请问这个是我使用错了么?

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.