Coder Social home page Coder Social logo

image-to-slices's People

Contributors

superraytin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

image-to-slices's Issues

Use as input a buffer from package sharp.

Is it possible to use this as input?

`sharp(path.join(picture.path, picture.name))
 .clone()
   .resize(Number(imgWidth), Number(imgHeight))
    .extract({ 

      left  : Math.round(left  )

    , top   : Math.round(top   )

    , width : Math.round(width )

    , height: Math.round(height)

    })
`

CORS issue

Hello,

I've been trying to use image-to-slices with images from different domain. The images served by the server do have the Access-Control-Allow-Origin * header. However I still get the error:
Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data when clipper crop calls getImageData
The way I call ImageToSlices is the following
var imageToSlice = new Image(); imageToSlice.onload = function () { ImageLoaded(imageToSlice); } imageToSlice.crossOrigin = "anonymous"; imageToSlice.src = imageUrlInOtherDomain + '?' + new Date().getTime();

Inside ImageLoaded I call
imageToSlices(imageToSlice.src, xGuides, yGuides, { saveToDataUrl: true, clipperOptions: { imageFormat: imageFormat } }, function (dataUrlList) { saveSlices(dataUrlList); }); }

Is it possible to pass the object imageToSlice which already has the attribute crossOrigin instead of imageToSlice.src? Could you give an example of how to correctly use image-to-slices with CORS?

Error: Require node-canvas on the server-side Node.js

So I have a Telegram bot that makes screenshots of a site with puppeteer, but they turn out too long, so I decided to slice them with image-to-slices. After installing both canvas and image-to-slices (image-clipper is present as well) when I run the script, it throws this error:

Error: Require node-canvas on the server-side Node.js
    at ImageClipper.__createImage (C:\Users\llgdd\Bots\node_modules\image-clipper\lib\clipper.js:456:13)
    at ImageClipper.loadImageFromUrl (C:\Users\llgdd\Bots\node_modules\image-clipper\lib\clipper.js:83:20)
    at ImageClipper.image (C:\Users\llgdd\Bots\node_modules\image-clipper\lib\clipper.js:120:10)
    at imageClipper (C:\Users\llgdd\Bots\node_modules\image-clipper\lib\index.js:36:15)
    at ImageToSlices.slice (C:\Users\llgdd\Bots\node_modules\image-to-slices\lib\image-to-slices.js:212:3)
    at ImageToSlicesFactory (C:\Users\llgdd\Bots\node_modules\image-to-slices\lib\index.js:22:17)

Can anyone help please? Would be cool to know what causes this.

Many slices causing segfault

I am working with really large images that I wish to tile at 256 * 256 tiles, thus means large arrays of slices i.e at least 20 * 20.

If I slice in large slices there are no issues but if i slice in 256px tiles i get a segfault:

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Is anyone else seeing this issue and have they been able to get around from what I can see it is 1 of 3 things:

  1. ran out of memory
  2. allocation of the array of the slices are incorrect
  3. The image should have been previously closed and wasnt.

Any pointers would be great.

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.