follmann / middleman-favicon-maker

Generate favicon files in various sizes from a base image in your middleman project
MIT License
114 stars 15 forks source link

All png icons are darker than original #24

Closed ockam closed 10 years ago

ockam commented 10 years ago

I’m generating a simple set of icons from a 24 bits PNG. Here’s my config:

  activate :favicon_maker, :icons => {
    "_favicon_template.png" => [
      { icon: "apple-touch-icon-152x152-precomposed.png" },
      { icon: "apple-touch-icon-114x114-precomposed.png" },
      { icon: "apple-touch-icon-72x72-precomposed.png" },
      { icon: "favicon.png", size: "16x16" },
      { icon: "favicon.ico", size: "16x16" }
    ]
  }

All png are a lot darker than the original, except for the ico file which is correct.

I tried changing my original to 32 bits, sRGB without success.

ockam commented 10 years ago

Just found the problem: I’m running imagoptim.

ockam commented 10 years ago

Made several tests and discovered that the PNG generated are OK when viewed on the desktop (OS X) or in a browser, but if you open them in Photoshop, you see a darker image. The same image you get if you run it through image_optim.

I presume there is something with the way PNG are saved in favicon_maker. I’m running imagemagick 6.8.7-7 and looking at the code, they should be sRGB, which is correct.

I have no clue on what to look for...

minusfive commented 10 years ago

I've noticed the same issue, but it gets weirder: after running several times, I've noticed the icons keep getting darker every time.

karland commented 10 years ago

@ockam Du you still have the problem. If yes, I have experienced the same or a similar problem and discovered the cause for it. The setup of favicon_maker is such that it changes the colorcode by default (RGB->sRGB) for imagemagick >= v6.8.0. If you are interested in more detail, look here. @minusfive That your pictures are getting darker is not explained by the change in colorcode. It rather sounds as if you are in some kind of loop. Below I am posting the setup from my middleman config.rb-File. With this I keep my templates outside the source folder in a folder that I call favicons. Maybe it helps...

activate :favicon_maker do |f|
  f.template_dir  = File.join(root, 'favicons')
  f.icons = {
    "favicon_template.png" => [
      { icon: "apple-touch-icon-152x152-precomposed.png" },
      { icon: "apple-touch-icon-144x144-precomposed.png" },
      { icon: "apple-touch-icon-120x120-precomposed.png" },
      { icon: "apple-touch-icon-114x114-precomposed.png" },
      { icon: "apple-touch-icon-76x76-precomposed.png" },
      { icon: "apple-touch-icon-72x72-precomposed.png" },
      { icon: "apple-touch-icon-precomposed.png", size: "72x72" },
      { icon: "favicon.png", size: "16x16" },
      { icon: "favicon.ico", size: "32x32,16x16" },
    ],
    "tile_template.png" => [
      { icon: "tile.png", size: "558x558" }
    ],
    "tile-wide_template.png" => [
      { icon: "tile-wide.png", size: "558x270" }
    ]
  }
end
follmann commented 10 years ago

The colorspace conversion has been removed, as didn't seem necessary anymore. Try v3.6that I just released which uses a reworked FaviconMaker version.

ockam commented 10 years ago

Problem solved. Thanks!

follmann commented 10 years ago

Great!