Code Monkey home page Code Monkey logo

Comments (5)

zhangyuanwei avatar zhangyuanwei commented on June 10, 2024

把报错信息贴出来看看?

from node-images.

happen-zhang avatar happen-zhang commented on June 10, 2024

问题描述和之前一样,如下错误信息。

希望你能帮我解决一下,谢谢~

ERROR: ../src/Image.cc:390 Image uninitialized. 

 Error: ../src/Image.cc:390 Image uninitialized.

from node-images.

zhangyuanwei avatar zhangyuanwei commented on June 10, 2024

单看这个报错信息,应该是图片格式的问题。我这没有能复现,方便的话可以把你的代码和要处理的图片发我邮箱。另外说明一下运行的环境(操作系统版本、node版本)。我这边看看是什么问题。
邮箱 zhangyuanwei1988#gmail.com

from node-images.

happen-zhang avatar happen-zhang commented on June 10, 2024

代码如下:

var images = require('images');
var img = images('a.png');

// 等比缩放
img.size(img.width() * 180 / img.height(), 180);

if (img.width() < 300) {
    return ;
}

if (img.height() < 180) {
    return ;
}

var x = (img.width() - 300) / 2;
var y = (img.height() - 215) / 2;
return images(img, x, y, 300, 180).save('b.png');

需要说明的是:我上传的图片格式为「jpg」,「png」两种格式,部分图片会上传失败,具体错误就如之前所说的,ERROR: ../src/Image.cc:390 Image uninitialized.(图片未初始化),这个就不太懂了:-)

from node-images.

happen-zhang avatar happen-zhang commented on June 10, 2024

images.size()方法会报错。

如果给size()传递的宽度或高度的值比原图片宽高值小的话,就会出现如下的错误信息:

ERROR: ../src/Image.cc:390 Image uninitialized. 

 Error: ../src/Image.cc:390 Image uninitialized.

即貌似不能进行缩小操作,望解决,谢谢~

from node-images.

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.