Skip to content

Remove ImageMagick Dependency #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ios-icon-generator is a shell script which aim to generate iOS APP icons easier and simply.
![image](https://github.com/smallmuou/ios-icon-generator/blob/master/ios-icon-generator.gif)
<pre>
VERSION: 1.0.0
VERSION: 1.1.0
USAGE:
./ios-icon-generator.sh srcfile dstpath

Expand All @@ -14,9 +14,6 @@ DESCRIPTION:
srcfile - The source png image. Preferably above 1024x1024
dstpath - The destination path where the icons generate to.

This script is depend on ImageMagick. So you must install ImageMagick first
You can use 'sudo brew install ImageMagick' to install it

AUTHOR:
Pawpaw<[email protected]>

Expand All @@ -29,24 +26,16 @@ EXAMPLE:
</pre>

### Usage
1. Install ImageMagick

Before you run this script, please check whether you had install ImageMagick. If you don't have install. Follow this:

```bash
sudo brew install ImageMagick
```

2. Clone And Chmod
1. Clone And Chmod

```bash
git clone https://github.com/smallmuou/ios-icon-generator
cd ios-icon-generator
chmod 777 ios-icon-generator.sh
```

3. Run
1. Run

```bash
StarnetdeMacBook-Pro:ios-icon-generator starnet$ ./ios-icon-generator.sh ~/Downloads/1024.png ~/output
[INFO] Generate iTunesArtwork.png ...
Expand Down Expand Up @@ -85,8 +74,11 @@ Use it in this way `./ios-custom-icon-generator.sh icon-big.png ~/asset_dir 100`
### Refer
* [App Icons on iPad and iPhone](https://developer.apple.com/library/ios/qa/qa1686/_index.html)
* [iOS Human Interface Guidelines](https://developer.apple.com/library/prerelease/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW1)

### History
* 1.1.0
* Removed ImageMagick dependency. Will run on stock installs of macOS.

* 1.0.0
* Generate all size icons for iPhone and iPad.

Expand Down
22 changes: 8 additions & 14 deletions ios-custom-icon-generator.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/bin/bash
#
# Copyright (C) 2015 Alessandro Miliucci<[email protected]>
#
#
# Based on https://github.com/smallmuou/ios-icon-generator/blob/master/ios-icon-generator.sh
# from Wenva <[email protected]>
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is furnished
# to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -29,7 +29,7 @@ SRC_FILE="$1"
DST_PATH="$2"
SIZE="$3"

VERSION=1.0.0
VERSION=1.1.0

info() {
local green="\033[1;32m"
Expand All @@ -56,9 +56,6 @@ DESCRIPTION:
dstpath - The destination path where the icons generate to.
size - The destination size in pixel, only one number (e.g 60)

This script is depend on ImageMagick. So you must install ImageMagick first
You can use 'sudo brew install ImageMagick' to install it

AUTHOR:
Alessandro Miliucci<[email protected]>

Expand All @@ -70,9 +67,6 @@ EXAMPLE:
EOF
}

# Check ImageMagick
command -v convert >/dev/null 2>&1 || { error >&2 "The ImageMagick is not installed. Please use brew to install it first."; exit -1; }

# Check param
if [ $# != 3 ];then
usage
Expand All @@ -92,12 +86,12 @@ FILENAME="${FILENAME%.*}"
OUT_FILENAME="$FILENAME.png"

info "Generate $FILENAME.png ..."
convert "$SRC_FILE" -resize "$SIZE"x"$SIZE" "$DST_PATH/$FILENAME.png"
sips "$SRC_FILE" -Z $SIZE --out "$DST_PATH/$FILENAME.png"
info "Generate [email protected] ..."
DOUBLE_SIZE=$(($SIZE * 2))
convert "$SRC_FILE" -resize "$DOUBLE_SIZE"x"$DOUBLE_SIZE" "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z $DOUBLE_SIZE --out "$DST_PATH/[email protected]"
TRIPLE_SIZE=$(($SIZE * 3))
info "Generate [email protected] ..."
convert "$SRC_FILE" -resize "$TRIPLE_SIZE"x"$TRIPLE_SIZE" "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z $TRIPLE_SIZE --out "$DST_PATH/[email protected]"

info 'Generate Done.'
60 changes: 27 additions & 33 deletions ios-icon-generator.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash
#
# Copyright (C) 2014 Wenva <[email protected]>
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is furnished
# to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -25,7 +25,7 @@ set -e
SRC_FILE="$1"
DST_PATH="$2"

VERSION=1.0.0
VERSION=1.1.0

info() {
local green="\033[1;32m"
Expand All @@ -51,9 +51,6 @@ DESCRIPTION:
srcfile - The source png image. Preferably above 1024x1024
dstpath - The destination path where the icons generate to.

This script is depend on ImageMagick. So you must install ImageMagick first
You can use 'sudo brew install ImageMagick' to install it

AUTHOR:
Pawpaw<[email protected]>

Expand All @@ -65,9 +62,6 @@ EXAMPLE:
EOF
}

# Check ImageMagick
command -v convert >/dev/null 2>&1 || { error >&2 "The ImageMagick is not installed. Please use brew to install it first."; exit -1; }

# Check param
if [ $# != 2 ];then
usage
Expand All @@ -82,59 +76,59 @@ fi
# Generate, refer to:https://developer.apple.com/library/ios/qa/qa1686/_index.html

info 'Generate iTunesArtwork.png ...'
convert "$SRC_FILE" -resize 512x512 "$DST_PATH/iTunesArtwork.png"
sips "$SRC_FILE" -Z 512 --out "$DST_PATH/iTunesArtwork.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 1024x1024 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 1024 --out "$DST_PATH/[email protected]"

info 'Generate Icon-20.png ...'
convert "$SRC_FILE" -resize 20x20 "$DST_PATH/Icon-20.png"
sips "$SRC_FILE" -Z 20 --out "$DST_PATH/Icon-20.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 40x40 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 40 --out "$DST_PATH/[email protected]"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 60x60 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 60 --out "$DST_PATH/[email protected]"

info 'Generate Icon-29.png ...'
convert "$SRC_FILE" -resize 29x29 "$DST_PATH/Icon-29.png"
sips "$SRC_FILE" -Z 29 --out "$DST_PATH/Icon-29.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 58x58 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 58 --out "$DST_PATH/[email protected]"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 87x87 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 87 --out "$DST_PATH/[email protected]"

info 'Generate Icon-40.png ...'
convert "$SRC_FILE" -resize 40x40 "$DST_PATH/Icon-40.png"
sips "$SRC_FILE" -Z 40 --out "$DST_PATH/Icon-40.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 80x80 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 80 --out "$DST_PATH/[email protected]"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 120x120 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 120 --out "$DST_PATH/[email protected]"

info 'Generate Icon-60.png ...'
convert "$SRC_FILE" -resize 60x60 "$DST_PATH/Icon-60.png"
sips "$SRC_FILE" -Z 60 --out "$DST_PATH/Icon-60.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 120x120 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 120 --out "$DST_PATH/[email protected]"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 180x180 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 180 --out "$DST_PATH/[email protected]"

info 'Generate Icon-76.png ...'
convert "$SRC_FILE" -resize 76x76 "$DST_PATH/Icon-76.png"
sips "$SRC_FILE" -Z 76 --out "$DST_PATH/Icon-76.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 152x152 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 152 --out "$DST_PATH/[email protected]"

info 'Generate Icon-57.png ...'
convert "$SRC_FILE" -resize 57x57 "$DST_PATH/Icon-57.png"
sips "$SRC_FILE" -Z 57 --out "$DST_PATH/Icon-57.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 114x114 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 114 --out "$DST_PATH/[email protected]"

info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 167x167 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 167 --out "$DST_PATH/[email protected]"

info 'Generate Icon-72.png ...'
convert "$SRC_FILE" -resize 72x72 "$DST_PATH/Icon-72.png"
sips "$SRC_FILE" -Z 72 --out "$DST_PATH/Icon-72.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 144x144 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 144 --out "$DST_PATH/[email protected]"

info 'Generate Icon-50.png ...'
convert "$SRC_FILE" -resize 50x50 "$DST_PATH/Icon-50.png"
sips "$SRC_FILE" -Z 50 --out "$DST_PATH/Icon-50.png"
info 'Generate [email protected] ...'
convert "$SRC_FILE" -resize 100x100 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 100 --out "$DST_PATH/[email protected]"

info 'Generate Done.'
22 changes: 8 additions & 14 deletions ios-navbar-icon-generator.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/bin/bash
#
# Copyright (C) 2015 Alessandro Miliucci<[email protected]>
#
#
# Based on https://github.com/smallmuou/ios-icon-generator/blob/master/ios-icon-generator.sh
# from Wenva <[email protected]>
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is furnished
# to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -28,7 +28,7 @@ set -e
SRC_FILE="$1"
DST_PATH="$2"

VERSION=1.0.0
VERSION=1.1.0

info() {
local green="\033[1;32m"
Expand All @@ -54,9 +54,6 @@ DESCRIPTION:
srcfile - The source png image. Preferably above 66x66
dstpath - The destination path where the icons generate to.

This script is depend on ImageMagick. So you must install ImageMagick first
You can use 'sudo brew install ImageMagick' to install it

AUTHOR:
Alessandro Miliucci<[email protected]>

Expand All @@ -68,9 +65,6 @@ EXAMPLE:
EOF
}

# Check ImageMagick
command -v convert >/dev/null 2>&1 || { error >&2 "The ImageMagick is not installed. Please use brew to install it first."; exit -1; }

# Check param
if [ $# != 2 ];then
usage
Expand All @@ -90,10 +84,10 @@ FILENAME="${FILENAME%.*}"
OUT_FILENAME="$FILENAME.png"

info "Generate $FILENAME.png ..."
convert "$SRC_FILE" -resize 22x22 "$DST_PATH/$FILENAME.png"
sips "$SRC_FILE" -Z 22 --out "$DST_PATH/$FILENAME.png"
info "Generate [email protected] ..."
convert "$SRC_FILE" -resize 44x44 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 44 --out "$DST_PATH/[email protected]"
info "Generate [email protected] ..."
convert "$SRC_FILE" -resize 66x66 "$DST_PATH/[email protected]"
sips "$SRC_FILE" -Z 66 --out "$DST_PATH/[email protected]"

info 'Generate Done.'