/**
 * Generate an icon file from a png file.
 * @function task.worker.generateIcoImage
 * @param {object} config - Work configuration.
 * @param {string} config.src - Source png file path.
 * @param {string} config.dest - Destination ico file path.
 * @param {function} callback - Callback when done.
 * @author Taka Okunishi
 *
 */

var path = require('path'),
    debug = require('./_debug'),
    lib = require('../../lib'),
    image = lib.image,
    png2ico = image.png2ico;

module.exports = function (config, callback) {
    var src = path.resolve(config.src),
        dest = path.resolve(config.dest);
    png2ico(src, dest, function (err) {
        if (!err) {
            debug.didCreateImage(dest);
        }
        callback(err);
    });
};