-1

I have few .png file very large, I want to compress them to reduce the size try to keep their quality as good as possible. Maybe one method is to convert the png from 32 to 24 bit (Convert 32bit PNG file to 24bit PNG file)?

The only think I found easy and fast is https://tinypng.com/ but compress the files in different way (some figure are 45% lighter but other are the same, no change in size).

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • Well that's the problem with compressing whilst avoiding/minimizing quality loss: it works better on some images than on others, and sometimes not at all. Would your material retain a sufficient quality after conversion to a good quality jpg? – fvu Sep 20 '16 at 17:16
  • Unfortunately I can't use jpg conversion. I should retain myself to png format. I found this rather essential http://stackoverflow.com/questions/27267073/imagemagick-lossless-max-compression-for-png – Panichi Pattumeros PapaCastoro Sep 20 '16 at 17:20
  • Any update on this question? – hackjutsu Oct 28 '16 at 23:13

1 Answers1

1

If you are familiar with Node.js, you can use the optimage package to perform image compression.

Example would be like

var optimage = require('optimage');

optimage({
    inputFile: "test.png",
    outputFile: "test.min.png"
}, function(err, res){
    // res.inputFile 
    // res.outputFile 
    // res.saved 
});

If you are familiar with gulp, you can use gulp-imagemin as well.

Example

const gulp = require('gulp');
const imagemin = require('gulp-imagemin');

gulp.task('default', () =>
    gulp.src('src/images/*')
        .pipe(imagemin())
        .pipe(gulp.dest('dist/images'))
);

There are many other ways to perform image compression which depends on the tech stack you choose. Most tools would provide arguments for adjusting the compression rate and image quality, which you need to read their documentations.

hackjutsu
  • 8,336
  • 13
  • 47
  • 87