question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to generate image from stream of raw input?

See original GitHub issue

I am trying to create an image (ideally to be output as a png) from raw pixel data, but I’m struggling to understand the desired format

const rs = Readable();
  const transformer = sharp({
    raw: {
      width,
      height,
      channels: 3,
    },
  });
  rs.pipe(transformer).pipe(createWriteStream(outputPath));

I have tried setting _read on rs to push Uint8Arrays, Buffers, and other types representing RGB data, but I inevitably get the Error: Unexpected data on Writable Stream error

I’m stumped, any help would be greatly appreciated

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
lovellcommented, Mar 19, 2019

v0.22.0 now available.

1reaction
flipactualcommented, Feb 16, 2019

Thanks for the quick reply, I’ll start working on it today

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating an image out of raw data in Java - Stack Overflow
Once you open an input stream from the server, create the image using ImageIO.read(InputStream) : public BufferedImage sendSelector(String ...
Read more >
From raw images to real-time predictions with Deep Learning
design a Convolutional Neural Network; train it from scratch by feeding batches of images; export it to reuse it with real-time image data...
Read more >
How should I get raw image data from a webcam in Linux ...
Look at the CaptureFrames() function. It uses ioctl() to query the device for parameters, to set up a bunch of memory mapped regions,...
Read more >
Constructor - High performance Node.js image processing
Constructor factory to create an instance of sharp , to which further methods are chained. JPEG, PNG, WebP, GIF, AVIF or TIFF format...
Read more >
FFmpeg Formats Documentation
When you configure your FFmpeg build, all the supported demuxers are enabled by default. ... Raw Audio Data Transport Stream AAC demuxer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found