Closed Arcovion closed 10 years ago
To be honest, this is a bit beyond for what I had in mind creating FaviconMaker.
Fair enough, it's certainly going beyond favicons. I found http://www.imagemagick.org/Usage/crop/#extent, and might try to add this myself if I really want it.
Sorry didn't mean to put you off. It is certainly possible, if you want to add it I'm fine. Is the assumption that if the image isn't square it should use the maximum space without stretching, be centered and fill the rest transparently?
Exactly, looks like the command would be something like -gravity center -extent #{dimensions} -background None
, applied as a second pass if the required image dimensions are not square. Actually this is possible within the minimagick wrapper, I was a bit scared of the #{escapes}
needed to ensure it works cross-platform but seeing as I don't need to touch that I might try it myself.
This was actually very easy, I realise now I made it seem much harder than it actually is. Even works with rectangular input, so for the large tiles it will just fill blank space above and below (like wide tile -> large tile here: http://msdn.microsoft.com/en-us/library/ie/dn455106(v=vs.85).aspx). Pull request sent.
just released an update version. thanks for your PR!
This site: http://realfavicongenerator.net Generates the windows tiles with some blank space around to make them look better in Windows 8, and also provides the wide tile 310x150 (or 558x270 if you follow this: http://msdn.microsoft.com/en-us/library/ie/dn455106(v=vs.85).aspx), something which this extension cannot currently do.
I tried it expecting the image to stretch, but it stayed square. What I wanted was for it to center the square in a 558x270 frame like the above site does. Windows 8 probably centers the image anyway, or just doesn't provide the wide tile if you don't specify it? I don't know how it all works since I don't use Windows 8.
Maybe this is even outside the scope of a favicon tool, I'm using the same favicon for the 70x70 tile as the 310x310 tile, I should probably redesign and add extra detail there. I actually don't know where to draw the line between favicons/mstiles/og:image lol, they can be completely different designs or all the same, depends on the purpose.
Adding an option to precompose the 310x150 tiles is what I originally wanted but after writing this I doubt I should provide a wide tile when my images will be square anyway. The site I linked is probably doing it wrong, what I think I'll do is make a custom wide tile, then add blank space above and below to center it vertically for the large 310x310 tile. That's still something this extension can help with, just adding the transparent space when the original image is a different aspect ratio to the generated image.
In short, add blank space and center the image vertically/horizontally when the target aspect ratio changes, and maybe add custom compositing for the mstile images. Probably too difficult, but something to think about.