Comments (23)
On Linux Mint/Ubuntu... I was getting this error, and I THOUGHT I had imagemagick installed, but it turns out I didn't... I saw the note on it maybe being related to images which are too big, so I set out manually resize it by installing imagemagick command line tool convert
sudo apt-get install imagemagick
Once I had imagemagick installed, that fixed the said problem for the larger size image (6315x4000 pixels)
from grunt-image-resize.
Thanks @thusoy for solving this on Windows.
Just complementing the solution for who doesn't know to change the imagemagick path on Windows 7+. Be sure to change only the C:/Program Files/ImageMagick-(version)
path to your grunt.js folder. (In my case, had many others values on the PATH variable).
👏👏😅
from grunt-image-resize.
Thanks for reporting David,
are you using the latest version of this plugin? We released 0.3.0 about a week ago and it should fix this issue (with imagemagick).
from grunt-image-resize.
thx ^_^
from grunt-image-resize.
I'm getting same error after processing the 10th image of a directory of 4000 images.
OS: OSX 10.9
imagemagick 6.8.7-0
grunt-image-resize: 0.3.0
here's grunt config:
image_resize: {
options: {
width: 100,
height: 100,
overwrite: true
},
organisms: {
files: [{
expand: true,
src: ['../photos_src/organisms2/**/*.jpg'],
dest: '../../photos/organisms/'
}]
}
},
from grunt-image-resize.
Could you please run grunt image_resize:organisms --stack
?
from grunt-image-resize.
here's the output as requested
$ grunt image_resize:organisms --stack
Running "image_resize:organisms" (image_resize) task
Image ../photos_src/organisms2/Genus_Acarnus^Species_bergquistae.jpg resized to ../../photos/photos_src/organisms2/Genus_Acarnus^Species_bergquistae.jpg
Image ../photos_src/organisms2/Genus^Isolderopa^iangallowayi.jpg resized to ../../photos/photos_src/organisms2/Genus^Isolderopa^iangallowayi.jpg
Image ../photos_src/organisms2/Genus_Acarnus^Species_caledoniensis.jpg resized to ../../photos/photos_src/organisms2/Genus_Acarnus^Species_caledoniensis.jpg
Image ../photos_src/organisms2/Genus_Acanthostrongylophora^Species_ashmorica.jpg resized to ../../photos/photos_src/organisms2/Genus_Acanthostrongylophora^Species_ashmorica.jpg
Image ../photos_src/organisms2/Encyocrypta^aureco^Raven.jpg resized to ../../photos/photos_src/organisms2/Encyocrypta^aureco^Raven.jpg
Image ../photos_src/organisms2/Genus_Amblypodia^Species_cyronthe.jpg resized to ../../photos/photos_src/organisms2/Genus_Amblypodia^Species_cyronthe.jpg
Image ../photos_src/organisms2/Encyocrypta^grandis^Raven.jpg resized to ../../photos/photos_src/organisms2/Encyocrypta^grandis^Raven.jpg
Image ../photos_src/organisms2/Encyocrypta^aureco.jpg resized to ../../photos/photos_src/organisms2/Encyocrypta^aureco.jpg
Image ../photos_src/organisms2/Encyocrypta_65.jpg resized to ../../photos/photos_src/organisms2/Encyocrypta_65.jpg
Image ../photos_src/organisms2/Genus_Aegisocoris^Species_kormilevi.jpg resized to ../../photos/photos_src/organisms2/Genus_Aegisocoris^Species_kormilevi.jpg
Fatal error: Cannot read property 'width' of undefined
TypeError: Cannot read property 'width' of undefined
at gm.module.exports (/Users/user/Documents/projectName/node_modules/grunt-image-resize/tasks/image_resize.js:73:44)
at gm.EventEmitter.emit (events.js:106:17)
at gm.Object.keys.forEach.proto.(anonymous function) (/Users/user/Documents/projectName/node_modules/grunt-image-resize/node_modules/gm/lib/getters.js:70:16)
at cb (/Users/user/Documents/projectName/node_modules/grunt-image-resize/node_modules/gm/lib/command.js:264:16)
at ChildProcess.module.exports.proto._spawn.proc.on.onExit (/Users/user/Documents/projectName/node_modules/grunt-image-resize/node_modules/gm/lib/command.js:246:9)
at ChildProcess.EventEmitter.emit (events.js:99:17)
at maybeClose (child_process.js:638:16)
at Process._handle.onexit (child_process.js:680:5)
from grunt-image-resize.
I believe that Imagemagick has issues with reading/parsing one of your images. I just made a commit that outputs the original error and tells you which image is affected. Maybe you can try that.
from grunt-image-resize.
I'm currently having this issue as well.
from grunt-image-resize.
I'm seeing this as well. Suspected large images to be the issue (5600x3600), but it failed also on a smaller resized version (1200x768).
from grunt-image-resize.
By any chance, could you send me the image files?
If I had some images where the error occurs, it would greatly help me debug.
from grunt-image-resize.
Sure, try this one: https://www.dropbox.com/s/xol3qq819cvewx9/_TKH4341.jpg
from grunt-image-resize.
I made a test for your image in https://github.com/excellenteasy/grunt-image-resize/tree/issue-9
It passes for me both on Mac OS and Ubuntu. Which version of ImageMagick are you running?
from grunt-image-resize.
Windows...
from grunt-image-resize.
I wasn't aware this runs on Windows, too. Anyways, I just tried it on a clean Win 8.1 and it passed aswell.
from grunt-image-resize.
Hmm, tested my setup on a Ubuntu box, still failing, so I can confirm that it's not a platform issue. Will dig a bit more.
from grunt-image-resize.
Have you tried the test suite or do you use your own Gruntfile? Maybe it's not an issue with the file after all.
from grunt-image-resize.
Got it working, not an issue with either the plugin or the file, was the ImageMagick install in my case. First time around I didn't have ImageMagick installed (you might want to add in the readme a little note saying you should have that installed and on the PATH), but installing it didn't solve the issue either, nor did relaunching cmd or a reboot. Much bantering back and forth, crashed on Ubuntu for other reasons (gruntfile fail), removed ImageMagick and re-installed, and then it started working.
So to others struggling, make sure ImageMagick is on your PATH and working (test it by typing convert -help
and you should get a long list of possible options, and then it should work.
To make it a bit easier to spot stuff like this in the future, you should probably add some error checking to your function calls, this was the line 71 gm(filepath).size
call that failed, and the error object was passed to your function (and the size
arg was thus undefined), so checking for err before using size could have at least provided us with a ENOENT error, which is thus easier to backtrack to a failing spawn, which again hints towards ImageMagick. 😌
from grunt-image-resize.
Thanks so much for investigating. The error handling is already in the master branch but not yet on npm. Maybe it's a good time to publish a new version. I added a section to the Readme for setting up ImageMagick.
from grunt-image-resize.
I had this issue as well. I succeeded to fix it with install imagemagick and create the $PATH to the folder.
from grunt-image-resize.
I also had this issue, seemed to be fixed following a brew update (mac osx)
from grunt-image-resize.
Interestingly, in another repo of mine I am still getting this issue regardless of the brew update, although it was fixed in another repo (using same version 0.3.0 in both).
from grunt-image-resize.
Had the same problem after installing ImageMagick with Homebrew:
brew install imagemagick
Tried re-installing, and got a warning that it was already installed, but not linked.
Uninstalled with:
brew uninstall imagemagick
Then installed again:
brew install imagemagick
And got an error that the brew link
step did not complete successfully. Followed the instructions and did:
brew link --overwrite imagemagick
It reported 71 symlinks were created.
Run grunt image_resize
and this time it worked successfully.
from grunt-image-resize.
Related Issues (20)
- Feature request: multiple image resizing options HOT 6
- Add option to specify the crop gravity HOT 6
- Scale Images? HOT 2
- Got "Cannot read property 'width' of undefined" HOT 5
- Feature Request: Filter Option for Resizing. HOT 4
- Resize based on image orientation.
- Add option to define aspect ratio instead of exact widths HOT 1
- Multiple image resize recursivelly ends up with fatal error HOT 5
- Folder structure is not preserved when copying images to a new directory
- Add copy / rename option
- Command failed: convert: negative or zero image size HOT 2
- Default width generates 1x1 image HOT 3
- Resize single file into multiple sizes at same time
- Convert CMYK images to RGB
- Windows gives EOF error HOT 1
- Quality "upscaling" when lower
- Is it possible to resize based on some condition? HOT 1
- Install PATH on CENTOS HOT 1
- Invalid Parameter - 100 HOT 3
- sub folder support for image resizing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-image-resize.