You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am working on a small project for the Feed My Starving Children foundation. I really like the JIMP package, however I'm unsure if I'm either missing something, or the following is an error with JIMP.
Here is the following use case I'm trying to implement:
I read a SECRET-IMAGE.PNG stored on my server. I then read the RELEASABLE-IMAGE.PNG on my server. I have a mongo database which runs through 1,000,000 entries, to detect whether a pixel for that image has been bought or not. If it was bought, I reveal that pixel by writing the pixel color FROM the secret-image.png, TO the releasable-image.png.
Here is the issue:
For some reason my releasable-image.png becomes extremely blocky. I think it has something to do with not being able to read the alpha value correctly. I debugged this by logging the alpha value for each bought pixel, and every time it returned a alpha value of 255.
Here is the code:
functionreloadImage(callbacks){returnJimp.read(imagePaths.secretPath).then(function(secretPic){console.log("Reading secret image!");Jimp.read(imagePaths.mainPath).then(function(releasedPic){console.log("Writing to Releasable image!");varcount=0;PixelSchema.find({}).lean().stream().on('data',function(pixelObj){varhex=pixelObj.isBought ? secretPic.getPixelColor(pixelObj.pixel.x,pixelObj.pixel.y)
: 0xFFFFFFFF;if(pixelObj.isBought){count++;}releasedPic.setPixelColor(hex,pixelObj.pixel.x,pixelObj.pixel.y);}).on('error',function(err){console.error("Error streaming the data!");console.error(err);}).on('close',function(){console.log('Done streaming the pixel data!');percentage=count/1000000.0;pixelsBoughtCount=count;releasedPic.write(imagePaths.mainPath,function(){console.log("done writing new image after bought pixels!");if(callbacks){returncallbacks();}});});});});};`
Here is the result:
Am I missing something, or would this be an issue with JIMP? (Notice the child in the background)
SECRET-IMAGE.PNG
RELEASABLE-IMAGE.PNG
The text was updated successfully, but these errors were encountered:
Hello, I am working on a small project for the Feed My Starving Children foundation. I really like the JIMP package, however I'm unsure if I'm either missing something, or the following is an error with JIMP.
Here is the following use case I'm trying to implement:
I read a SECRET-IMAGE.PNG stored on my server. I then read the RELEASABLE-IMAGE.PNG on my server. I have a mongo database which runs through 1,000,000 entries, to detect whether a pixel for that image has been bought or not. If it was bought, I reveal that pixel by writing the pixel color FROM the secret-image.png, TO the releasable-image.png.
Here is the issue:
For some reason my releasable-image.png becomes extremely blocky. I think it has something to do with not being able to read the alpha value correctly. I debugged this by logging the alpha value for each bought pixel, and every time it returned a alpha value of 255.
Here is the code:
Here is the result:
Am I missing something, or would this be an issue with JIMP? (Notice the child in the background)
SECRET-IMAGE.PNG
RELEASABLE-IMAGE.PNG
The text was updated successfully, but these errors were encountered: