bash update
This commit is contained in:
parent
033935bf67
commit
fd853aebaa
70
Makefile
Normal file → Executable file
70
Makefile
Normal file → Executable file
@ -1,4 +1,3 @@
|
|||||||
#
|
|
||||||
# All-in-one website favicon generator
|
# All-in-one website favicon generator
|
||||||
# Copyright (C) 2019 Illya Marchenko <stuzer05@gmail.com>
|
# Copyright (C) 2019 Illya Marchenko <stuzer05@gmail.com>
|
||||||
#
|
#
|
||||||
@ -15,8 +14,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
CC = magick
|
CC = convert
|
||||||
FILE ?= source.png
|
SOURCE ?= source.png
|
||||||
|
|
||||||
# Files & forlders
|
# Files & forlders
|
||||||
DIST = dist
|
DIST = dist
|
||||||
@ -102,51 +101,50 @@ override define file_source
|
|||||||
@echo '<meta name="msapplication-config" content="'$(ICON_PATH)'ieconfig.xml">' >> $(DIST)source.html
|
@echo '<meta name="msapplication-config" content="'$(ICON_PATH)'ieconfig.xml">' >> $(DIST)source.html
|
||||||
endef
|
endef
|
||||||
|
|
||||||
all: $(FILE)
|
all: $(SOURCE)
|
||||||
-mkdir $(DIST) $(dist_public)
|
-mkdir $(DIST) $(dist_public) $(dist_icons)
|
||||||
-mkdir $(DIST) $(dist_icons)
|
|
||||||
|
|
||||||
@echo "Generating.. Regular icons"
|
@echo "Generating.. Regular icons"
|
||||||
$(CC) $(FILE) -resize 16x16! $(dist_icons)favicon-16x16.png
|
@$(CC) $(SOURCE) -resize 16x16! $(dist_icons)favicon-16x16.png
|
||||||
$(CC) $(FILE) -resize 32x32! $(dist_icons)favicon-32x32.png
|
@$(CC) $(SOURCE) -resize 32x32! $(dist_icons)favicon-32x32.png
|
||||||
$(CC) $(FILE) -resize 48x48! $(dist_icons)favicon-48x48.png
|
@$(CC) $(SOURCE) -resize 48x48! $(dist_icons)favicon-48x48.png
|
||||||
$(CC) $(FILE) -resize 57x57! $(dist_icons)favicon-57x57.png
|
@$(CC) $(SOURCE) -resize 57x57! $(dist_icons)favicon-57x57.png
|
||||||
$(CC) $(FILE) -resize 76x76! $(dist_icons)favicon-76x76.png
|
@$(CC) $(SOURCE) -resize 76x76! $(dist_icons)favicon-76x76.png
|
||||||
$(CC) $(FILE) -resize 96x96! $(dist_icons)favicon-96x96.png
|
@$(CC) $(SOURCE) -resize 96x96! $(dist_icons)favicon-96x96.png
|
||||||
$(CC) $(FILE) -resize 128x128! $(dist_icons)favicon-128x128.png
|
@$(CC) $(SOURCE) -resize 128x128! $(dist_icons)favicon-128x128.png
|
||||||
$(CC) $(FILE) -resize 192x192! $(dist_icons)favicon-192x192.png
|
@$(CC) $(SOURCE) -resize 192x192! $(dist_icons)favicon-192x192.png
|
||||||
$(CC) $(FILE) -resize 192x192! $(dist_icons)favicon-196x196.png
|
@$(CC) $(SOURCE) -resize 192x192! $(dist_icons)favicon-196x196.png
|
||||||
$(CC) $(FILE) -resize 228x228! $(dist_icons)favicon-228x228.png
|
@$(CC) $(SOURCE) -resize 228x228! $(dist_icons)favicon-228x228.png
|
||||||
|
|
||||||
@echo "Packing.. triple-sized favicon.ico"
|
@echo "Packing.. triple-sized favicon.ico"
|
||||||
$(CC) $(dist_icons)favicon-16x16.png $(dist_icons)favicon-32x32.png $(dist_icons)favicon-48x48.png $(dist_public)favicon.ico
|
@$(CC) $(dist_icons)favicon-16x16.png $(dist_icons)favicon-32x32.png $(dist_icons)favicon-48x48.png $(dist_public)favicon.ico
|
||||||
|
|
||||||
@echo "Generating.. Android icons"
|
@echo "Generating.. Android icons"
|
||||||
$(CC) $(FILE) -resize 196x196! $(dist_icons)favicon-196x196.png
|
@$(CC) $(SOURCE) -resize 196x196! $(dist_icons)favicon-196x196.png
|
||||||
$(CC) $(FILE) -resize 192x192! $(dist_icons)android-chrome-192x192.png
|
@$(CC) $(SOURCE) -resize 192x192! $(dist_icons)android-chrome-192x192.png
|
||||||
$(CC) $(FILE) -resize 196x196! $(dist_icons)android-chrome-512x512.png
|
@$(CC) $(SOURCE) -resize 196x196! $(dist_icons)android-chrome-512x512.png
|
||||||
|
|
||||||
@echo "Generating.. Apple icons"
|
@echo "Generating.. Apple icons"
|
||||||
$(CC) $(FILE) -resize 57x57! $(dist_icons)apple-touch-icon-57x57.png
|
@$(CC) $(SOURCE) -resize 57x57! $(dist_icons)apple-touch-icon-57x57.png
|
||||||
$(CC) $(FILE) -resize 114x114! $(dist_icons)apple-touch-icon-114x114.png
|
@$(CC) $(SOURCE) -resize 114x114! $(dist_icons)apple-touch-icon-114x114.png
|
||||||
$(CC) $(FILE) -resize 72x72! $(dist_icons)apple-touch-icon-72x72.png
|
@$(CC) $(SOURCE) -resize 72x72! $(dist_icons)apple-touch-icon-72x72.png
|
||||||
$(CC) $(FILE) -resize 144x144! $(dist_icons)apple-touch-icon-144x144.png
|
@$(CC) $(SOURCE) -resize 144x144! $(dist_icons)apple-touch-icon-144x144.png
|
||||||
$(CC) $(FILE) -resize 60x60! $(dist_icons)apple-touch-icon-60x60.png
|
@$(CC) $(SOURCE) -resize 60x60! $(dist_icons)apple-touch-icon-60x60.png
|
||||||
$(CC) $(FILE) -resize 120x120! $(dist_icons)apple-touch-icon-120x120.png
|
@$(CC) $(SOURCE) -resize 120x120! $(dist_icons)apple-touch-icon-120x120.png
|
||||||
$(CC) $(FILE) -resize 76x76! $(dist_icons)apple-touch-icon-76x76.png
|
@$(CC) $(SOURCE) -resize 76x76! $(dist_icons)apple-touch-icon-76x76.png
|
||||||
$(CC) $(FILE) -resize 152x152! $(dist_icons)apple-touch-icon-152x152.png
|
@$(CC) $(SOURCE) -resize 152x152! $(dist_icons)apple-touch-icon-152x152.png
|
||||||
$(CC) $(FILE) -resize 180x180! $(dist_icons)apple-touch-icon.png
|
@$(CC) $(SOURCE) -resize 180x180! $(dist_icons)apple-touch-icon.png
|
||||||
$(CC) $(FILE) -resize 180x180! $(dist_public)apple-touch-icon.png
|
@$(CC) $(SOURCE) -resize 180x180! $(dist_public)apple-touch-icon.png
|
||||||
$(CC) $(FILE) -resize 180x180! -quality 80% $(dist_public)apple-touch-icon-precomposed.png
|
@$(CC) $(SOURCE) -resize 180x180! -quality 80% $(dist_public)apple-touch-icon-precomposed.png
|
||||||
|
|
||||||
@echo "Generating.. IE 10 Metro tile icons"
|
@echo "Generating.. IE 10 Metro tile icons"
|
||||||
$(CC) $(FILE) -resize 144x144! $(dist_icons)mstile-144x144.png
|
@$(CC) $(SOURCE) -resize 144x144! $(dist_icons)mstile-144x144.png
|
||||||
|
|
||||||
@echo "Generating.. IE 11 Metro tile for Windows 8.1 start screen"
|
@echo "Generating.. IE 11 Metro tile for Windows 8.1 start screen"
|
||||||
$(CC) $(FILE) -resize 70x70! $(dist_icons)mstile-small.png
|
@$(CC) $(SOURCE) -resize 70x70! $(dist_icons)mstile-small.png
|
||||||
$(CC) $(FILE) -resize 150x150! $(dist_icons)mstile-medium.png
|
@$(CC) $(SOURCE) -resize 150x150! $(dist_icons)mstile-medium.png
|
||||||
$(CC) $(FILE) -resize 310x150! $(dist_icons)mstile-wide.png
|
@$(CC) $(SOURCE) -resize 310x150! $(dist_icons)mstile-wide.png
|
||||||
$(CC) $(FILE) -resize 310x310! $(dist_icons)mstile-large.png
|
@$(CC) $(SOURCE) -resize 310x310! $(dist_icons)mstile-large.png
|
||||||
|
|
||||||
@echo "Generating.. manifest.json"
|
@echo "Generating.. manifest.json"
|
||||||
$(file_manifest)
|
$(file_manifest)
|
||||||
|
89
README.md
89
README.md
@ -6,7 +6,7 @@ This includes iOS Safari, Google Chrome, Mozilla Firefox, Windows 8 and 10, and
|
|||||||
To get started with favicon generator you need to make sure [ImageMagick](https://imagemagick.org/index.php) and the latest [GNU make](https://www.gnu.org/software/make/) software are installed and present in your PATH environment variable.
|
To get started with favicon generator you need to make sure [ImageMagick](https://imagemagick.org/index.php) and the latest [GNU make](https://www.gnu.org/software/make/) software are installed and present in your PATH environment variable.
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
By default, makefile uses `magick` filename for ImageMagick software, but you can change that by specifying a new name as a parameter for make
|
By default, makefile uses `convert` file of ImageMagick software, but you can change that by specifying a new name as a parameter for make
|
||||||
```
|
```
|
||||||
make CC=<executable name>
|
make CC=<executable name>
|
||||||
```
|
```
|
||||||
@ -24,53 +24,62 @@ or by changing the following line
|
|||||||
FILE ?= <image filename>
|
FILE ?= <image filename>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Using bash
|
||||||
|
You use bash script `generate.sh` to use the program anywhere on your system. First of, you have to areat a symbolic link to an executable using the following command
|
||||||
|
```bash
|
||||||
|
$ ln -s <path to program>/generate.sh ~/.local/bin/webicongen
|
||||||
|
# example: ln -s ~/Programs/Favicons_generation/generate.sh ~/.local/bin/webicongen
|
||||||
|
```
|
||||||
|
then you can use it in such a way
|
||||||
|
```bash
|
||||||
|
$ webicongen <image> <output dir>
|
||||||
|
```
|
||||||
|
The output directory will be created automatically.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
After everything is configured, simply place your image in the same directory as makefile, and then simply run `make`. It will generate the following directory structure
|
After everything is configured, simply place your image in the same directory as makefile, and then simply run `make`. It will generate the following directory structure
|
||||||
```
|
```
|
||||||
dist
|
dist/
|
||||||
│ source.html
|
├── public
|
||||||
│
|
│ ├── apple-touch-icon.png
|
||||||
└───public
|
│ ├── apple-touch-icon-precomposed.png
|
||||||
│ apple-touch-icon-precomposed.png
|
│ ├── favicon.ico
|
||||||
│ apple-touch-icon.png
|
│ ├── icons
|
||||||
│ favicon.ico
|
│ │ ├── android-chrome-192x192.png
|
||||||
│ manifest.json
|
│ │ ├── android-chrome-512x512.png
|
||||||
│
|
│ │ ├── apple-touch-icon-114x114.png
|
||||||
└───icons
|
│ │ ├── apple-touch-icon-120x120.png
|
||||||
android-chrome-192x192.png
|
│ │ ├── apple-touch-icon-144x144.png
|
||||||
android-chrome-512x512.png
|
│ │ ├── apple-touch-icon-152x152.png
|
||||||
apple-touch-icon-114x114.png
|
│ │ ├── apple-touch-icon-57x57.png
|
||||||
apple-touch-icon-120x120.png
|
│ │ ├── apple-touch-icon-60x60.png
|
||||||
apple-touch-icon-144x144.png
|
│ │ ├── apple-touch-icon-72x72.png
|
||||||
apple-touch-icon-152x152.png
|
│ │ ├── apple-touch-icon-76x76.png
|
||||||
apple-touch-icon-57x57.png
|
│ │ ├── apple-touch-icon.png
|
||||||
apple-touch-icon-60x60.png
|
│ │ ├── favicon-128x128.png
|
||||||
apple-touch-icon-72x72.png
|
│ │ ├── favicon-16x16.png
|
||||||
apple-touch-icon-76x76.png
|
│ │ ├── favicon-192x192.png
|
||||||
apple-touch-icon.png
|
│ │ ├── favicon-196x196.png
|
||||||
favicon-128x128.png
|
│ │ ├── favicon-228x228.png
|
||||||
favicon-16x16.png
|
│ │ ├── favicon-32x32.png
|
||||||
favicon-192x192.png
|
│ │ ├── favicon-48x48.png
|
||||||
favicon-196x196.png
|
│ │ ├── favicon-57x57.png
|
||||||
favicon-228x228.png
|
│ │ ├── favicon-76x76.png
|
||||||
favicon-32x32.png
|
│ │ ├── favicon-96x96.png
|
||||||
favicon-48x48.png
|
│ │ ├── ieconfig.xml
|
||||||
favicon-57x57.png
|
│ │ ├── mstile-144x144.png
|
||||||
favicon-76x76.png
|
│ │ ├── mstile-large.png
|
||||||
favicon-96x96.png
|
│ │ ├── mstile-medium.png
|
||||||
ieconfig.xml
|
│ │ ├── mstile-small.png
|
||||||
mstile-144x144.png
|
│ │ └── mstile-wide.png
|
||||||
mstile-large.png
|
│ └── manifest.json
|
||||||
mstile-medium.png
|
└── source.html
|
||||||
mstile-small.png
|
|
||||||
mstile-wide.png
|
|
||||||
```
|
```
|
||||||
`source.html` contains HTML code that needs to be pasted in your document's head.
|
`source.html` contains HTML code that needs to be pasted in your document's head.
|
||||||
|
|
||||||
|
|
||||||
`public` folder must be the same as your project's public folder, you can simply copy-paste it into your project (make sure you don't have one of these generated files already in your project, such as `manifest.json`).
|
`public` folder must be the same as your project's public folder, you can simply copy-paste it into your project (make sure you don't have one of these generated files already in your project, such as `manifest.json`).
|
||||||
|
|
||||||
# Acknowledgements
|
# Acknowledgements
|
||||||
I would love to hear any ideas or issues regarding this makefile. Make sure to create an issue or a pull request.
|
I would love to hear any ideas or issues regarding this makefile. Make sure to create an issue or a pull request.
|
||||||
|
|
||||||
You can also send me an email at stuzer05@gmail.com
|
You can also send me an email to stuzer05 at gmail.com
|
||||||
|
19
generate.sh
Executable file
19
generate.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
SCRIPT_FOLLOW=`realpath $0`
|
||||||
|
SCRIPT=`realpath -s $0`
|
||||||
|
SCRIPTPATH=`dirname $SCRIPT_FOLLOW`
|
||||||
|
CALLPATH=`pwd`
|
||||||
|
me=`basename "$0"`
|
||||||
|
|
||||||
|
DIST="dist"
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
DIST=$2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
make -C $SCRIPTPATH SOURCE="$(pwd)/$1" DIST="$CALLPATH/$DIST"
|
||||||
|
else
|
||||||
|
echo -e "Error: missing arguments\n"
|
||||||
|
echo -e "USAGE:"
|
||||||
|
echo -e "\t$me <image> <output dir>"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user