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.

GraphicsMagick Steams Failing?

See original GitHub issue

I am having trouble getting node-gm streams to be accepted by form-data, for example the following code:

gm('somefilepath.png')
  .resize(100, 100)
  .noProfile()
  .stream(function(err, stdout, stderr) {
    form = new FormData()
    form.append('file', stdout)
    form.submit('http://foo')
  })

fails with an error

events.js:71
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: Parse Error
    at Socket.socketOnData (http.js:1367:20)
    at TCP.onread (net.js:403:27)

Note that file streams work no problem with form-data, but i just can’t get the GM stream. Thoughts?

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:44 (21 by maintainers)

github_iconTop GitHub Comments

2reactions
imjaredcommented, Feb 27, 2015

Just stumbled across this when I thought I was going to lose my mind. Probably not too helpful to you two at this point but if some weary traveller finds this thread, adding the filetype solved my issue:

.stream('png', function( err, stdout, stderr ) {

    var buf = new Buffer(0);

    stdout.on('data', function(data) {
        buf = Buffer.concat([buf, data]);
    });

    stdout.on('end', function() {

        var data = {
            Bucket: 'my-bucket-name',
            Key: imageFilename,
            Body: buf
        };

        s3.putObject(data, function( err, response ) {
            if ( err ) {
                console.log( err );
            } else {
                console.log( chalk.green('Image #' + iterator + ' successfully generated for ' + text ) );
                iterator++;
                setImmediate( generateImages );
            }
        });
    });
0reactions
alexindigocommented, Apr 22, 2013

Sad. Good thing you can stream to disk and back, so you can show some kind of progress to the user.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Graphics Magick stream()'s stdout.on('data') does not run
I made a simple code to demonstrate this problem. In the code below, I attempted to log out data in the on 'data'...
Read more >
2018 - GraphicsMagick
ScaleImage() suffers from two problems related to the blending of fully transparent pixels with non-fully transparent pixels during the scaling operation.
Read more >
filesize returns the size of the original file, even after ... - GitHub
I see. I think that makes sense. If I understand you correctly, setFormat and resize are only finalized after calling stream . Thanks...
Read more >
463258 – Spumux fails to handle png-type subtitles
Created attachment 317405 [details] output of spumux in dvdauthor-0.6.14-5.fc9.i386 and spumux compiled from source. Description of problem: When trying to ...
Read more >
GraphicsMagick / News
Some JPEG warnings were being reported as errors and this caused problems for some files. PerlMagick failed to pass its test suite due...
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