image-scramble
image-scramble copied to clipboard
got silent error that make the plugin unusable
Hi. I try to use your library for a while now but I can't get it to work.
I put some console.log in your file to track the issue, and it seems that on the save function in async.auto function, only the first slice is working.
here is your file with my console.log
save:['getSlices',function(callback,results){
var totalParts = results.totalParts;
var allSlices = [];
new Jimp(results.getSize.bitmap.width,results.getSize.bitmap.height,function(err, image){
console.log('callbackJimp')
async.forEachOf(results.getSlices,function(slices,k,done){
console.log('foreach slices 1st callback')
var size = k.split("-");
var group = getGroup(slices,results.getSize.bitmap);
var shuffleInd = [];
for(var i=0;i<slices.length;i++) shuffleInd.push(i);
shuffleInd = shuffleSeed.shuffle(shuffleInd,options.seed);
console.log('pre foreach slices shuffle')
console.log(slices)
async.forEachOf(slices,function(slice,i,callback){
console.log(slice)
console.log(i)
var pos = getPartPos(shuffleInd[i],group);
var srcPos = getPartPos(i,group);
console.log('srcPos:')
console.log(srcPos)
console.log('pos:')
console.log(pos)
image.blitAdv(results.getSize, group.x+pos.x, group.y+pos.y, group.x+srcPos.x, group.y+srcPos.y, Number(size[0]), Number(size[1]));
console.log('image:')
console.log(image)
delete sliceImg;
callback(err);
},done)
},function(err){
console.log('foreach slices 2nd callback')
console.log(err);
if(err) callback(err);
if(!options.buffer){
image.write(options.dest,callback)
} else {
image.getBuffer( Jimp.MIME_PNG, callback );
}
})
});
}]
and at the moment when I log the srcPos and pos I got this for the first slice
srcPos:
{ x: 0, y: 0 }
pos:
{ x: 0, y: 0 }
and on the second
srcPos:
{ x: NaN, y: NaN }
pos:
{ x: NaN, y: NaN }
after that, the image.blitAdv fails silently and nothing happen (my console.log of the image after that is not shown)
EDIT : On my tests my seed was 'abcdef' and sliceSize 200