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

Fatal error: Cannot call method 'match' of undefined #4

Closed dwightjack closed 11 years ago

dwightjack commented 11 years ago

When running the image_resize task i got the following error:

Fatal error: Cannot call method 'match' of undefined

My task configuration is:

        image_resize: {
            options: {
                width: 100,
                overwrite: true
            },
            resize: {
                files: [
                    {
                        flatten: true,
                        expand: true,
                        cwd: '<%= paths.images %>/products/src',
                        src: ['*.jpg'],
                        dest: '<%= paths.images %>/products/resized/',
                        ext: '.jpg'
                    }
                ]
            }
        }

My current system is:

OS: Ubuntu 12.04 Grunt: 0.4.1

davidpfahler commented 11 years ago

I'm looking into it. Why are you using ext: '.jpg'?

Of course this is not an acceptable solution, but can you try running it once again, please?

dwightjack commented 11 years ago

Hi,

i removed the line, but had no luck.

I further investigated the problem, and the error seems to arise on node-imagemagick lib in node-imagemagick/lib/imagemagick.js at line 168:

result.format = result.format.match(/\S*/)[0]

the result object on my test image is as follow:

{ '</svg>':
   { profiles:
      { 'profile-8bim': '15496 bytes',
        'profile-exif': '11443 bytes',
        'profile-iptc': '47 bytes',
        'city[1,90]': '0x00000000',
        'unknown[2,0]': '' },
     'profile-xmp': '5693 bytes' },
  artifacts: { verbose: 'true' },
  tainted: 'False',
  filesize: '102KBB',
  number_pixels: '60.3KB',
  pixels_per_second: '602.79TB',
  user_time: '0.000u',
  elapsed_time: '0:01.000',
  version: 'ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org' }
vogloblinsky commented 11 years ago

David,

Any news about this issue ?

Thanks

Regards

davidpfahler commented 11 years ago

@vogloblinsky Do you have the problem as well? To me, it seems to be an imagemagick bug.

vogloblinsky commented 11 years ago

I have the problem too. Yes it is an mode-imagemagick issue, and seems related to picture size or another thing. An image which fails, works fine after an opening and save in Photoshop. After that, works fine.

davidpfahler commented 11 years ago

@vogloblinsky @dwightjack Maybe you guys can knock at the door of node-imagemagick. I'm just wrapping that library for grunt, but maybe they know more about that. Sorry, I can't be of more help right now.