excellenteasy / grunt-image-resize

Unmaintained. If you'd like to take this over please let us know. Resizing images made easy - thanks to imagemagick.
MIT License
57 stars 46 forks source link

Multiple image resize recursivelly ends up with fatal error #22

Open umpirsky opened 9 years ago

umpirsky commented 9 years ago

I want to resize all images inside this folder recursively (and keep folder structure).

Here is my config:

image_resize: {
      resize: {
        options: {
          width: 400,
        },
        expand: true,
        src: '<%= yeoman.app %>/images/menu/**/*',
        dest: '<%= yeoman.dist %>/thumbnails/'
      }
    }

When I run it:

$ grunt image_resize
Running "image_resize:resize" (image_resize) task
Fatal error: Cannot read property 'width' of undefined

Execution Time (2015-03-29 00:24:10 UTC)
loading tasks         2ms  ▇▇▇ 3%
image_resize:resize  77ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 97%
Total 79ms

Code is available on https://github.com/umpirsky/meni.rs/commit/24f3b7696b65d4ee94483b4c6138cacdfdf368a0.

I am aware of https://github.com/excellenteasy/grunt-image-resize/issues/14 and https://github.com/excellenteasy/grunt-image-resize/issues/11, but looks like it is not my case.

I noticed that it resizes successfully only for first folder, and then fails with this error.

caiobleggi commented 8 years ago

+1 (win10)

caiobleggi commented 8 years ago

Found any solution?

umpirsky commented 8 years ago

Iirc I ended up using grunt-responsive-images.

nicothin commented 8 years ago

+1 (win 10 64)

honsa commented 6 years ago

Had same issue, image resize shows this error on grunt job

Fatal error: Cannot read property 'width' of undefined

Problem can be tracked down to line 72 in image_resize.js

gm.(filepath).size(function(err))

which err output shows:

Error: Could not execute GraphicsMagick/ImageMagick: identify "-ping" "-format" "%wx%h" 
"public/img/xyz.jpg" this most likely means the gm/convert binaries can't be found

Solution on win10 is, reinstall ImageMagick with the legacy utilities

image

https://github.com/bamlab/generator-rn-toolbox/blob/master/generators/assets/README.md#troubleshooting