superraytin / image-to-slices Goto Github PK
View Code? Open in Web Editor NEWNode.js module for converting image into slices with the given reference lines.
License: MIT License
Node.js module for converting image into slices with the given reference lines.
License: MIT License
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)
})
`
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?
Can we change name of images ??
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.
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:
Any pointers would be great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.