Questions tagged [pngjs]

9 questions
3
votes
1 answer

Read Image from Buffer with pngjs

What I expect: I'm trying to read a PNG image from a url and then parse it with pngjs What I get: Error: Invalid file signature What I tried: The result of urlToBuffer() is definitely a Buffer. I tried different encodings, tried different http…
2
votes
0 answers

Is there a to download image SYNCHRONUSLY from FIREBASE storage? And pass it to PNG.sync.read?

So developing this app is nodejs that uses firebase firestore and firebase storage. What I am trying to do is, I already have a couple of images in firebase storage. I would randomly download an image and perform stego on it. For this purpose, I…
2
votes
1 answer

Method from the pngjs library acts weirdly in Node.js

I am ordering images by a score value calculated by the getImageScore method, which is wrapped in a promise, as it takes quite some time to load the pixels it has to work with. I observed that the promises get blocked, never being finished. This was…
2
votes
1 answer

React: How to Read a PNG in the client/browser and parse it to PNGJS

I am using React JS to develop my application. I know how to import an image in the client/browser folder structure In my case: import maze_text from '../../mazes/images/maze_text.png'; I would like to read that PNG file so I can pass it to…
preston
  • 3,721
  • 6
  • 46
  • 78
1
vote
0 answers

How transform pixel array to png with PNGJS SYNC

I'm doing it like this and it works fine const png = new PNG({ width: 2048, height: 2048, filterType: 4, }); png.data = mydata; png.pack().pipe(fs.createWriteStream("image.png")); but it uses stream and I need it to be sync I tried the…
MrCano369x
  • 328
  • 3
  • 6
0
votes
0 answers

Reading PNGs pixel by pixel

I'm trying to go through PNG files pixel by pixel. The data I'm using looks like this: data:image/png;base64,iVBORw0KGgoAAAANSUh.... Following this question, I had no success. The accepted solution fails at var png = new PNG(data); and gives the…
L.P.
  • 3
  • 1
0
votes
1 answer

saving image is taking too long android

I use this code to save an image, but it takes a long time. Sometimes it takes 10 second or more. I have decreased the bitmap size and it helps. But it also decreases the quality. How can I save bitmap in its original size without decrease in…
sara a
  • 1
  • 2
0
votes
0 answers

NodeJS: How To Create An RGBA PNG or TGA in Javascript / PNGJS

I am populating 'imageData', applying it to a canvas, and then need to save it as a RGBA 16 or 32 bit image from Javascript. // Set all the alpha values to max. for (let i = 0; i < 64 * 64; i++){ imageData.data[(i * 4) + 3] =…
Selzier
  • 101
  • 1
  • 6
  • 19
-1
votes
1 answer

Understanding and Converting Ruby's ChunkyPNG to Javascript Equivalent

I am converting some RUBY code into Javascript. This RUBY code uses ChunkyPNG Ruby Library. Here is the Ruby Code: def self.from_png(file) image = ChunkyPNG::Image.from_file(file) mask = Mask.new(image.height, image.width) mask.rows.times do…
preston
  • 3,721
  • 6
  • 46
  • 78