gruntjs / grunt-contrib-imagemin

Minify PNG, JPG, GIF and SVG images.
https://gruntjs.com
MIT License
1.21k stars 175 forks source link

0.6 jpeg compresses to 0 bytes #187

Closed davidosomething closed 10 years ago

davidosomething commented 10 years ago
// IMAGEMIN ////////////////////////////////////////////////////////////////////
    imagemin: {
      all: {
        files: [{
          expand: true,
          cwd:  'assets/img/source/',
          src:  [ '**/*.{png,jpg,jpeg,gif}' ],
          dest: 'assets/img/release/'
        }]
      }
    },

https://www.dropbox.com/s/v8u6fipdta5yuyx/bg-fest.jpg

this jpg compresses to zero bytes

kevva commented 10 years ago

Only JPEG images? Do you have jpegtran installed globally (which jpegtran)?

kevva commented 10 years ago

Ok, think I found the problem. Looks like it's mkdirp.

primozcigler commented 10 years ago

The issue here. Ubuntu 13.10, PNG and JPG files: https://dl.dropboxusercontent.com/u/47486136/screenshots/imagemin.png

kevva commented 10 years ago

@primozcigler, reinstall. Issue should be fixed.

jamesplease commented 10 years ago

Closing -- comment here if it's still a problem after reinstalling and it can be revisited.

primozcigler commented 10 years ago

Removed 0.6.0, installed 0.6.1, the problem with JPGs is solved, the PNGs are still the same. In the CLI says everything is OK, but the pngs are still 0 bytes.

jefftmills commented 10 years ago

Also getting 0 byte PNGs but good JPGs with 0.6.1. The problem happens on our codeship.io builds using Ubuntu 12.10 but works OK on my local Ubuntu 13.04 in a VM on a Windows machine.

vladikoff commented 10 years ago

@kevva I think we must ignore the global installations of image optimizers. Seems like Ubuntu 12.10 might have some old version of the optimizer that is really broken?

kevva commented 10 years ago

@vladikoff, maybe we could check version?

kevva commented 10 years ago

I've implemented both features in https://github.com/kevva/bin-wrapper/commit/654fb53523d10ac159d81ddf697866cc434888a5 and https://github.com/kevva/bin-wrapper/commit/75c849d425cdab501d65896de90ecd19ef051f3f.

danyeah commented 10 years ago

Using 0.6.1 and didn't solve the issue, still getting jpegs 0 bytes. Im on windows 7 x64. Tried updating jpegtran to the latest version but still no luck.

danyeah commented 10 years ago

Had to switch back to version 0.5.0 to make it work.

mrksmts commented 10 years ago

Same issue occurs here in both 0.6 and 0.6.1 with OSX 10.9.2

DavidKk commented 10 years ago

+1, I have the same problem。 osx 10.8.4

kevva commented 10 years ago

Will fix soon.

donovanmuller commented 10 years ago

Just to add my experience:

On Mint 16 (Ubuntu 13.10) using version 0.6.1 and was getting zero length png's (jpg's were fine). optipng version was 0.6.4 (from Ubuntu repos) Downloaded, compiled and installed latest optipng (0.7.4) - http://kb.imakewebsites.ca/2012/10/16/installing-optipng-0-7-3-on-ubuntu-12-04/

Working again :)

aghouseh commented 10 years ago

Still broken for me as well (OSX 10.9.2 & imagemin 0.6.1) on both JPG and PNG files. Is there an interim workaround that anyone has found and can share?

vladikoff commented 10 years ago

Try the latest version from GitHub, use npm cache clean and then npm install gruntjs/grunt-contrib-imagemin. Let us know how it goes!

ghost commented 10 years ago

That seems to be OK now.

primozcigler commented 10 years ago

Doesn't work for me yet. It is better (no more 0-bytes files), but still problems ...

Gruntfile:

imagemin: {
    options: {
        progressive: false,
    },
    build: {
        files: [{
            expand: true,
            cwd:    'src/images',
            src:    ['**/*.{png,gif,jpg,jpeg}'],
            dest:   'build/images'
        }]
    }
},

CLI:

Running "imagemin:build" (imagemin) task
✔ src/images/420-slider/slider-image-2.jpg (already optimized)
✔ src/images/420-slider/slider-image-4.jpg (already optimized)
✔ src/images/420-slider/slider-image-3.jpg (already optimized)
✔ src/images/dummy-licensed/about-us-image.jpg (already optimized)
✔ src/images/dummy-licensed/blog-image-3-small.jpg (saved 177 B - 2%)
✔ src/images/dummy-licensed/blog-image-2.jpg (already optimized)
✔ src/images/420-slider/slider-image-1.jpg (already optimized)
✔ src/images/dummy-licensed/blog-image-small.jpg (already optimized)
✔ src/images/dummy/about-1.jpg (already optimized)
✔ src/images/dummy/about-2.jpg (already optimized)
✔ src/images/dummy-licensed/blog-image-3.jpg (already optimized)
✔ src/images/dummy/about-3.jpg (already optimized)
✔ src/images/dummy/about-4.jpg (saved 66 B - 2%)
✔ src/images/dummy-licensed/blog-image.jpg (already optimized)
✔ src/images/dummy/about-5.jpg (already optimized)
✔ src/images/dummy/about-6.jpg (already optimized)
✔ src/images/dummy/ads-160x600.jpg (saved 26 B - 1%)
✔ src/images/dummy/ads-300x250.jpg (saved 917 B - 16%)
Warning: Command failed: ** Error: Lossy operations are not currently supported
 Use --force to continue.

Aborted due to warnings.
kevva commented 10 years ago

@primozcigler, #180. Update OptiPNG.

primozcigler commented 10 years ago

Phew!

Working now, tnx!

mcometa commented 10 years ago

Installing this worked for me.

https://github.com/yeoman/node-optipng-bin#node-optipng-bin-

DavidKk commented 10 years ago

ok thx ^_^

------------------ 原始邮件 ------------------ 发件人: "Marc Cometa"; 发送时间: 2014年5月2日(星期五) 上午10:56 收件人: "gruntjs/grunt-contrib-imagemin"; 抄送: "David"; 主题: Re: [grunt-contrib-imagemin] 0.6 jpeg compresses to 0 bytes (#187)

Installing this solved my problem.

https://github.com/yeoman/node-optipng-bin#node-optipng-bin-

— Reply to this email directly or view it on GitHub.