mahnunchik / gulp-responsive

gulp-responsive generates images at different sizes
https://npmjs.com/gulp-responsive
MIT License
503 stars 60 forks source link

Some images to jpg, some to png #32

Closed dandaka closed 8 years ago

dandaka commented 8 years ago

This is not a task, but rather a question.

Use case. Some images are better (smaller size and less compression artifacts) to be converted to PNG (graphics), some to JPG (photos). Usual scenario is like this:

  1. Have a look at images
  2. Specify which output as JPG, which as PNG. Right now the best solution is to make this decision before going to gulp-responsive in file extensions. So .PNG → .PNG, .JPG → .JPG. Alternative is configuration in JSON (either gulpfile.js or each folder), which is more complicated to setup.

How do you config such cases? Maybe there is another hidden option inside next branch, that should be documented :)

To make it more automatic, we could use https://github.com/Huddle/Resemble.js to analyse artefacts (difference) from different output. And select optimal. But this sounds like a huge task with big risks.

mahnunchik commented 8 years ago

Hi @dandaka

Yep, it is good question :smile:

I think it is task for some kind of config-generators.

For example I use this one gulp-responsive-config. It parses image filename (by this module parse-image-dimensions) and produces per-image configuration.

Image image-100x200@2x.png became:

{
  name: 'image.png',
  width: 200,
  height: 400,
  rename: 'image-100x200@2x.png'
}

I really use them in production but I haven't enough time to prepare them to release and document usage. Sorry :cry:

dandaka commented 8 years ago

Any plans to do it some time? Any help needed?

dandaka commented 8 years ago

Maybe you can throw few example of production code, so I can guess from that.

mahnunchik commented 8 years ago

It is one of planed tasks https://github.com/mahnunchik/gulp-responsive/issues/23 :smile:

I will try to do it today.

mahnunchik commented 8 years ago

Hi @dandaka

Usage examples: https://github.com/mahnunchik/gulp-responsive/tree/master/examples

dandaka commented 8 years ago

That's cool, thank you!