You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This favicon module require up to 30 seconds to generate all icons and splash screens on my VPS server (4 core, 8G ram), but I likely decrease converting speed to 3 seconds. (10X improving!)
I do it for my personal use, but if someone interesting to implement this in favicon module, I will be happy to explain.
Generating icons
First of all I use ffmpeg lib with next pattern: one input -> multiple output.
I install ffmpeg via standard OS package manager (It's install old version of ffmpeg v3.2.15, but we not need something special and old version will be ok to use): sudo apt-get install ffmpeg
And next key step is to follow one input -> multiple outputffmpeg pattern. As short example, now I showing how to generate 2 output icons 50x50 and 100x100: (in real world we need to generate all icons sizes dynamically)
And next step It's just execute this command from node.js process.
var { stdout, stderr } = await exec('ffmpeg .......')
As result we will have in out folder a lot of icons.
Generating splash screens
This process little bit tricky. We need fill background color and place our app icon at center. To do so I use standard ffmpeg options:
for filled background I use next ffmpeg filters as input (for example generate 3000x3000 green rectangle):
And next step is to use ffmpeg overlay filter to place our app icon at the center of our background rectangle. (in real world we need to generate series of splash screens dynamically)
This favicon module require up to 30 seconds to generate all icons and splash screens on my VPS server (4 core, 8G ram), but I likely decrease converting speed to 3 seconds. (10X improving!)
I do it for my personal use, but if someone interesting to implement this in favicon module, I will be happy to explain.
Generating icons
First of all I use
ffmpeg
lib with next pattern:one input -> multiple output
.I install
ffmpeg
via standard OS package manager (It's install old version offfmpeg v3.2.15
, but we not need something special and old version will be ok to use):sudo apt-get install ffmpeg
And next key step is to follow
one input -> multiple output
ffmpeg pattern. As short example, now I showing how to generate 2 output icons 50x50 and 100x100: (in real world we need to generate all icons sizes dynamically)And next step It's just execute this command from node.js process.
As result we will have in
out
folder a lot of icons.Generating splash screens
This process little bit tricky. We need fill background color and place our app icon at center. To do so I use standard
ffmpeg
options:for filled background I use next
ffmpeg filters as input
(for example generate 3000x3000 green rectangle):And next step is to use
ffmpeg overlay
filter to place our app icon at the center of our background rectangle. (in real world we need to generate series of splash screens dynamically)And after executing next command it we will have series of splash screens:
Real world code
The text was updated successfully, but these errors were encountered: