Code Monkey home page Code Monkey logo

node-vips's Issues

Writing 50mb output file for 10mb input file after shrink operation

Hi!
libvips has every possible thing I could possibly need for a very involving project and is super fast!
I'm trying to use it from node because there're a few things sharp doesn't do that libvips supports.

The following script produced an image that was 5 times the input size i.e. ~10.2mb to ~56.8mb

var vips = require('vips-ffi');
var image = vips.Image.newFromFile('patrick-hendry-547014-unsplash.jpg');
image.shrink(50, 50)
image.writeToFile('testc.png')

How would I resize an image?

Investigate fastcall as possible replacement for node-ffi

I came across fastcall, I thought let's open an issue to track this.

There is a a popular dynamic binding library for Node.js:
node-ffi. Then why we need another one could ask? For performance! There is a good 20x-40x
function call performance overhead when using node-ffi compared to hand made C++ native module, which is unacceptable in most cases (see the benchmarks).

fastcall has an almost 100% node-ffi compatible interface, so it could work as a drop-in replacement of node-ffi.

(I can't work on this before February 2019, since I'm currently busy with my internship.)

TODO

Things that need doing before we could declare 1.0, in no order:

  • Documentation
  • Sort out naming conventions: we should probably switch to newFromFile(), for example
  • what about .bandsplit() and .bandjoin()? Should they be .bandSplit() and .bandJoin()?
  • Fix module structure, hide internal things
  • Have something to generate convenience members for Image, eg. Image.black should be generated automatically.
  • Need convenience functions like Image.prototype.bandsplit
  • Enum expansions, eg. Image.prototype.sin
  • Need to handle the libvips error buffer
  • Fix up exceptions
  • More arithmetic wrappers need doing by hand, eg. see Image.prototype.add
  • Load/save unformatted memory areas, eg. a Buffer holding a uint8 pixel array
  • Load/save formatted memory areas, eg. a string holding a PNG
  • Need to wrap VipsInterpolate
  • Some examples
  • Benchmarks
  • Make it "just work" on Windows (it works right now, but you have to change the library names, see the FIXME notes)
  • We open the libraries several times. It would be better to open once and share the handles. We could have code to use the Windows library names in just one place then as well.
  • We seem to leak some buffers in example/thumb.js in memory mode, investigate
  • Travis integration
  • Add vips.call.async

Please add more!

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.