Git Product home page Git Product logo

gm's Issues

-flatten

I'm trying to run a command equivalent to:

convert Foo.psd -flatten Foo.jpg

Is there any way as of right now to get this -flatten working? If not, where can I start poking around to add it?

PNG module for GM

Hi I've installed gm on server, with gif images it works fine, but when I use png image the error are thrown - "Command failed: gm identify: No decode delegate for this image format (/tmp/logo.png)". I've installed libpng and zlib but still have this error, what must I do to make it works???

Can I get image blob?

Hello. Can I somehow get image blob after transformations without writing to filesystem? (I see write method all the time that writes to filesystem, but couldn't find method for getting image blob)

Composite?

Can composite be added please? I need to composite one image on top of another at a specific location. I cannot figure out what to do from the source (looking at morph example).

Please advise. Thanks!

Edit: Also, the source image needs to be cropped and resized. Should this be done with 2 steps or can this be passed as args to the composite command?

npm warning

Seeing this warning when I run "npm install" with gm >= 1.1.0 in my app's package.json. Did the format of the bugs section of package.json change?

Non-conforming primitive error on drawPolygon

Occurs for me whenever I draw any polygon, polyline, or bezier. These functions worked for me in previous versions.

If you look at those three methods in drawing.js it looks like the draw method is being passed an array of arguments rather than having the array of arguments .applied to it.

I fixed this for myself by changing:

return this.draw(["polyline"].concat(formatPoints(arguments)));

to

return this.draw.apply(this, ["polyline"].concat(formatPoints(arguments)));

for all three functions.

Not working with imagemagick?

Hello,

Just to point out that I first try the module and had the following error:

Error: Command failed: execvp(): No such file or directory

Since I only had imagemagick installed, I tried installing graphicsmagick and everything ran smoothly.

Cheers

ERROR: spawn EMFILE (80 file limit?)

Error: spawn EMFILE
at errnoException (child_process.js:481:11)
at ChildProcess.spawn (child_process.js:444:11)
at child_process.js:342:9
at gm._spawn (/Users/myusername/node_modules/gm/lib/command.js:156:16)
at gm._exec (/Users/myusername/node_modules/gm/lib/command.js:137:17)
at gm.identify (/Users/myusername/node_modules/gm/lib/getters.js:74:10)
at gm.size (/Users/myusername/node_modules/gm/lib/getters.js:33:12)

.. attempted to walk a directory, getting image sizes for each image encountered.

Node: 0.6.12
OS: mac osx 10.6.8

I tried directly calling gm(<filename>).size(function(e, v){ ... }); on the last file in the list before the error, and it worked fine.

I created an array literal containing the 81 image filenames logged to the console leading up to the error and iterating over just them. Same result. But as soon as I removed any one of them from the array, everything was ok.

Graceful failure when graphicsmagick is not available

Currently gm.stream will hang and the following error is reported:

  Error: write EPIPE
     at errnoException (net.js:646:11)
     at Object.afterWrite [as oncomplete] (net.js:480:18)

It would be nice if the error is detected and an informative error returned to any callbacks.

Document how run tests so new contributors can more easily contribute

As a new contributor, I couldn't figure out how to run the tests:

npm test

or

make test

failed. I'm not sure if it's because the tests themselves are not passing or if there is an extra step needed to get the test suite running that I did not complete. It would be nice to document that on the README so that new contributors can run the test suite.

Can't parse EXIF data using ImageMagick

When using ImageMagick, the identify method doesn't output correct EXIF data.

The problem is with the regex, because ImageMagick returns the EXIF data in this format:

exif:Model: Canon

You only end up with a "exif" property after executing identify.

Error running with nodejs w32 binaries

Hi,i run nodejs win32 binaries and get this error with gm :
{"0":
...
type:undefined,
message:"Command failed: execvp(): No such file of directory\n",
killed:false,
code:127,
...
"1" : "",
"2" : "execvp(): No such file or directory\n",
"3": "gm convert -size 420x220 ....

How can fix that.
Thanks

Resize options?

Thanks for the convenience library, works great. The only thing I'd wish for is a bit more flexibility regarding the resize options.

http://www.graphicsmagick.org/GraphicsMagick.html#details-geometry

To get the most out of it I think the function could be redefined something like:

// http://www.graphicsmagick.org/GraphicsMagick.html#details-resize
//valid arguments : width, height, options

proto.resize = function resize(args) {
var size;
size = "";
if (args.width != null) {
size += args.width;
}
size += "x";
if (args.height != null) {
size += args.height;
}
resize = size;
if (args.options != null) {
resize += args.options;
}
return this["in"]("-size", size).out("-resize", resize);
};

Tests Fail

I am trying to get the tests to pass so that I have a good starting point but I am running into problems. Bellow is the output from the tests. How can I figure out what tests are failing?

$ node test/index.js
√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√√░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Error: Command failed: execvp failed, errno = 2 (No such file or directory)
gm convert: "gs" "-q" "-dBATCH" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=ppmraw" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4" "-r72x72" "-g680x136" "-sOutputFile=/var/folders/dm/y_gb705d3kz_x0rkrd7t36zw0000gn/T/gmPdl5eB" "--" "/var/folders/dm/y_gb705d3kz_x0rkrd7t36zw0000gn/T/gmV58OUO" "-c" "quit".
execvp failed, errno = 2 (No such file or directory)
gm convert: "gs" "-q" "-dBATCH" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=ppmraw" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4" "-r72x72" "-g680x136" "-sOutputFile=/var/folders/dm/y_gb705d3kz_x0rkrd7t36zw0000gn/T/gmPdl5eB" "--" "/var/folders/dm/y_gb705d3kz_x0rkrd7t36zw0000gn/T/gmV58OUO" "-c" "quit".
gm convert: Postscript delegate failed (/var/folders/dm/y_gb705d3kz_x0rkrd7t36zw0000gn/T/gmIigJjO).
execvp failed, errno = 2 (No such file or directory)
gm convert: "gs" "-q" "-dBATCH" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=ppmraw" "-dTextAlphaBits=4" "-dGraphicsAlphaBits

crop.resize on JPEG

Doing crop then resize on a JPEG image (PNG seems ok) results in:```
Command failed: gm convert: geometry does not contain image (unable to crop image).


Removing ```
in("-size",  w +"x"+ h)

in lib/args.js:13 solves the issue, however I'm not sure about the deeper consequences.

Reserved word

Hi

I have got this error on [email protected]:

    ./node_modules/gm/index.js:59
    var super = gm;

    SyntaxError: <unknown message reserved_word>

Node version 0.6.7

streamed content-length?

Hey, I've been using GM for some time and am quite happy with how it makes my life easier :)
I've been trying to wrap my head around a new approach I'm trying and wondering why it isn't working as expected.
I'm using following code and want to push the stream to my amazon s3 bucket with aws2js module;

var readStream = fs.createReadStream('/path/to/my/img.png');
gm(readStream, 'img.png')
.stream(function (err, stdout, stderr) {
    s3.putStream(path, stdout, 'public-read', {'content-type': 'image/png', 'content-length': ?????}, function (err, result) {
    ....
    });
});

everything works fine with aws2js and streams, IF I know the content-length (when I just directly store the picture without resize). But when I don't specify the content-length, it doesnt work and my file ends up beeing 0bytes in size.
Since I'll be wanting to resize the picture and then send it to my bucket, I'll need to know how big the resized img will be.

Is there a way, how I can retrieve that information?

Thank you for your help in kicking me in the right direction :)

Error message if GraphicMagick is not installed

Hi,

I think the gm module should throw an error if graphicmagick is not installed on the system. It should atleast say that "Install graphicmagick or switch to Imagemagick".

Right now it just throws a cryptic error with a error code which on Googling translates into "Command not found".

Thanks

Does not play well with streams paused by connect

If I have a stream that is paused, pass it to gm, then resume it, stream gives an error:

var gm = require("gm");
var fs = require("fs");
var pause = require("connect").utils.pause;

var source = fs.createReadStream("img.png");
var pauser = pause(source);

setTimeout(function () {
    gm(source, "img.png")
        .resize(200, 200)
        .stream("png", function (err, stdout, stderr) {
            if (err) {
                console.log("err", err);
                process.exit(1);
            } else {
                stdout.pipe(process.stdout);
                stderr.pipe(process.stderr);
            }
        });

    pauser.resume();
}, 100);
$ node test.js
err [Error: gm().stream() or gm().write() with a non-readable stream. Pass "{bufferStream: true}" to identify() or getter (size, format, etc...)]

The problem is that the stream does indeed have readable: false since it's already emitted all its events, which are caught by connect and stored in the _events property to be re-emitted later, when I call pauser.resume().

So I guess it's partially connect's fault, since usually you can assume that non-readable streams will not emit any more events. But, a solution is kind of necessary, since there's otherwise no way to defer streaming image processing until after an asynchronous event (e.g. user authorization) has occurred. Note that the native stream's pause method does not work on HTTP streams; data events get dropped, necessitating something like connect's custom pause function.

Not sure what a good solution is here. For now I've hacked around it by inserting source.readable = true before calling gm.

/cc @visionmedia for any connect-related advice, @isaacs since this is an interesting case of "unfuck HTTP"

why got the error:'command failed'

I install gm on windows with npm.
When I run the 'thumb' example,I got the 'Error: Command failed: CreateProcessW: xxxxx' and 'code: 127, signal: null'
Dose gm support in windows?

tests randomly fail

not sure which test yet. after resolving this we can tag/release

stream.js:74
    dest.end();
         ^
TypeError: Object [object Object] has no method 'end'
    at Socket.onend (stream.js:74:10)
    at Socket.emit (events.js:81:20)
    at Socket._onReadable (net.js:652:51)
    at IOWatcher.onReadable [as callback] (net.js:177:10)
make: *** [test] Error 1

gm delegates missing

When I installed gm with prefix I got this error

Command failed: gm identify: Unable to access configuration file (delegates.mgk) [No such file or directory].

Installing it without a prefix fixed that error but I now get errors like this when I try to open an image

code

gm(files.file.path).size(function (err, size) {
    console.log(err);
    console.log(size);
});

error

Command failed: gm identify: No decode delegate for this image format (/tmp/8c058c811a50b6441e98723c777b3199.JPG).

Animated GIFs return 'identify' data for last frame

The parser for the identify output in getters.js gathers all the key=value pairs after the Image: header, but does not handle gathering the output for multiple images.

I've patched on my branch to make this return the output from the first image, because the first image in the series contains the correct canvas size.

I can either issue a pull request for this work-around, or I can make the parser gather the output for multiple images, or something else.

thoughts?

gm identify: Unable to open file (/tmp/gmtDcxxb) [No such file or directory].

I'm using gm to downsample and crop images and am seeing this error fairly regularly, about 1% of requests. Making the same call a second time works just fine so it doesn't appear to be a problem with the inputs.

I realize it's internal to graphicsmagick but was hoping you might have some insight into what might be causing the issue and ways to alleviate the problem.

some helpfull methods are missing

Could you add some helpfull methods for graphicsMagicks and ImageMagicks such as "setInterlaceScheme", "stripImage", "compositeImage", and "clone"?

Frames support

Support for frame manipulation with animated GIF files.

Ability to remove frames, add frames, etc.

Ability to detect number of frames.

Ability to detect number of used pixels and pixel colors on a frame.

Animated Gifs break 'identify'?

Hi,

I saved this file to my hard drive: http://www.prguitarman.com/comics/poptart1red1.gif
When I run this code:

gm(tmp_path).identify(function(err, data){
                console.log(data);
});

I get this error?

[TypeError: Cannot set property 'Image' of undefined]
TypeError: Cannot set property 'Image' of undefined
    at ChildProcess.<anonymous> (/home/user/abc/src/node_modules/gm/lib/getters.js:121:18)
    at ChildProcess.<anonymous> (/home/user/abc/src/node_modules/gm/lib/command.js:208:18)
    at ChildProcess.emit (events.js:70:17)
    at maybeExit (child_process.js:361:16)
    at Process.onexit (child_process.js:397:5)

I just want to determine if a file is animated gif or not, I don't necessarily need to perform any operations on that image.

thanks!

raw image data serialization

Hello-

This is not really an issue but more of a question. Is there a feasible way to store/retrieve the image data from/to memory instead of hitting the filesystem? It seems like this was possible in PHP but I don't remember for sure.

Thanks,
Matt

Unexpected size as result when having multicalls on the same file

I am not sure what happens here but really weird.

Node v0.8.2 on Mac (unfortunately can not determine if I run GraphicsMagick or ImageMagick)

Code

var gm = require('gm');
gm( __dirname + '/data/img/icons/favicon.png').size(function(err, size) {
console.log(size);
});

gm( __dirname + '/data/img/icons/favicon.png').size(function(err, size) {
console.log(size);
});

gm( __dirname + '/data/img/loading.gif').size(function(err, size) {
console.log(size);
});

gm( __dirname + '/data/img/loading.gif').size(function(err, size) {
console.log(size);
});

Images can be found here

https://github.com/vanng822/jcash/blob/master/tests/data/img/icons/favicon.png
https://github.com/vanng822/jcash/blob/master/tests/data/img/loading.gif

Output

-----node test.js, good output
{ width: 16, height: 16 }
{ width: 16, height: 16 }
{ width: 35, height: 35 }
{ width: 35, height: 35 }
-----node test.js
{ width: 16, height: 16 }
undefined
{ width: 35, height: 35 }
{ width: 35, height: 35 }
------ node test.js
{ width: 16, height: 16 }
undefined
{ width: 35, height: 35 }
{ width: 35, height: 35 }
------node test.js
{ width: 16, height: 16 }
undefined
{ width: 35, height: 35 }
{ width: 1, height: 1 }

getterIdentify.js test fails

The getterIdentify.js test is failing for me on line 15 due to what is perhaps a floating point rounding difference. Here is the output:


Jubilee:gm[master]$ make test
The "sys" module is now called "util". It should have a similar interface.

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
AssertionError: "71.71 (0.2812)" == "71.70 (0.2812)"
    at gm.<anonymous> (/Users/joshua/Working/libraries/gm/test/getterIdentify.js:15:12)
    at ChildProcess.<anonymous> (/Users/joshua/Working/libraries/gm/lib/getters.js:142:23)
    at ChildProcess.<anonymous> (/Users/joshua/Working/libraries/gm/lib/command.js:207:18)
    at ChildProcess.emit (events.js:70:17)
    at maybeExit (child_process.js:360:16)
    at Socket.<anonymous> (child_process.js:457:7)
    at Socket.emit (events.js:67:17)
    at Array.16 (net.js:335:10)
    at EventEmitter._tickCallback (node.js:192:40)
make: *** [test] Error 1


This is on Node v0.6.14. Is anyone else having issues like this with the test suite? 

Performing a large number of operations

I am using gm to create large images with many small items drawn on them (a map in a computer game). The problem is that beyond a certain number of operations I start to receive the error "Command failed: execvp(): Argument list too long". This can be reproduced with the following code:

var Gm = require('gm');
var image = Gm(100, 100, '#FFF');
for (var i = 0; i < 10000; i++) {
image.drawCircle(0,0,5,5);
}
image.write('test.gif', function(e) {
if (e) {
console.log('Error:');
console.log(e);
}
else {
console.log('Done.');
}
});

I am able to circumvent this issue by writing to file every few iterations, but this seems hacky because I never really know how much more 'argument room' is available and the constant writes really slows things down.

IPTC data in identify

Hey,

graphicsmagik returns IPTC data such as caption, GPS etc on the command line

gm identify -ping -verbose image.jpg

However the node gm identify wrapper only returns a subset of this data, even thought it uses the same command as above.

I believe only few changes will be needed to the parser that transforms stdout to JSON.

Read from buffer

Would it be possible to add buffer as one of the options for gm? Reason I ask is because I'm reading a stream for a base64 encoded image and I create a new buffer from it, but since gm only accepts a string I have to write it to file first and then read the file instead of being able to go straight to gm with the buffer.

Thanks! ^^

Support for mogrify?

I'm trying to scale an image in place. Is there any way to do something equivalent to:

gm mogrify -size 120x120 my-image.jpg -resize 120x120

Error using .minify()

Error: Command failed: gm convert: Unable to open file (1) [No such file or directory].

It looks like the factor is getting passed in as a filename or something.

Error: CreateProcessW: The system cannot find the file specified. on Windows 7

Hi,

I tried to resize image with gm but I got this error

[2012-06-05 03:02:58.648] [INFO] console - Error: Command failed: CreateProcessW: The system cannot find the file specified.

at ChildProcess.<anonymous> (C:\Users\user00492\workspace\inbrush\node_modules\gm\lib\command.js:203:17)
at ChildProcess.emit (events.js:70:17)
at maybeExit (child_process.js:362:16)
at Socket.<anonymous> (child_process.js:467:7)
at Socket.emit (events.js:67:17)
at Array.1 (net.js:335:10)
at EventEmitter._tickCallback (node.js:192:40)

I am using node v0.6.17 on windows 7, and this is my code

var gm = require('gm');
gm('C:/Users/user00492/default.jpg')
.resize(40, 40)
.noProfile()
.write(
'C:/Users/user00492/resized.jpg', function(err) {
if (!err)
console.log('done');
else
console.log(err)
});

Could anyone help me to fix this problem?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.