Commit 7ca545a1 authored by Alessandro Portale's avatar Alessandro Portale
Browse files

A shell script for creating application icons



This script creates several application icon files by using
Inkscape to rasterize .svg items to .png, adding shadows via
imagemagick, creating .ico files via imagemagick and .icns
files via iconutil (OSX only).

Also, this change tweaks applicationicons.svg so that the
shadows won't be cut off.

Change-Id: Ie8adf37d775fa5ea02329451932956f760c17620
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
parent b04313e1
......@@ -807,13 +807,13 @@
inkscape:connector-curvature="0"
id="path3424"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 21.589978,394.29039 c -0.01445,9.1e-4 -0.02844,0.002 -0.04253,0.002 -0.31877,0 -0.561552,-0.22762 -0.723653,-0.68703 -0.171949,-0.48232 -0.257326,-1.30384 -0.257326,-2.46169 0,-1.1982 0.08786,-1.98968 0.26133,-2.37157 0.160306,-0.35041 0.390293,-0.52488 0.689365,-0.52488 0.02366,0 0.0481,9.2e-4 0.07281,0.004 0.32282,0.0283 0.563623,0.2525 0.724573,0.66738 0.160904,0.4129 0.240067,1.16531 0.240067,2.25948 0,1.21882 -0.07995,2.03587 -0.241954,2.45236 -0.163113,0.42048 -0.403502,0.64106 -0.722686,0.66121 z m 0,-7.08721 c -0.119297,-0.0139 -0.235188,-0.0209 -0.347167,-0.0209 -0.699904,0 -1.256072,0.27317 -1.654787,0.82883 -0.472356,0.65841 -0.712561,1.69668 -0.712561,3.10359 0,1.30462 0.175494,2.30231 0.520222,2.98419 0.339711,0.67129 0.830339,1.07121 1.459594,1.20533 0.136971,0.66375 0.350665,1.11249 0.640348,1.34507 0.218849,0.17612 0.509866,0.26341 0.86946,0.26341 0.108619,0 0.22405,-0.008 0.345096,-0.0236 l 0.414817,-0.0538 0,-0.90379 c -0.124243,0.002 -0.223488,0.008 -0.331373,-0.002 -0.107886,-0.01 -0.213189,-0.0537 -0.280339,-0.11388 -0.120034,-0.10873 -0.210473,-0.3143 -0.270122,-0.62069 0.591837,-0.20244 1.024335,-0.63976 1.307758,-1.30816 0.278498,-0.65906 0.416435,-1.55175 0.416435,-2.68687 0,-1.23915 -0.187276,-2.18265 -0.568686,-2.84101 -0.388452,-0.67289 -0.985352,-1.06127 -1.808695,-1.1561"
d="m 21.589978,394.29039 c -0.01445,9.1e-4 -0.02844,0.002 -0.04253,0.002 -0.31877,0 -0.561552,-0.22762 -0.723653,-0.68703 -0.171949,-0.48232 -0.257326,-1.30384 -0.257326,-2.46169 0,-1.1982 0.08786,-1.98968 0.26133,-2.37157 0.160306,-0.35041 0.390293,-0.52488 0.689365,-0.52488 0.02366,0 0.0481,9.2e-4 0.07281,0.004 0.32282,0.0283 0.563623,0.2525 0.724573,0.66738 0.160904,0.4129 0.240067,1.16531 0.240067,2.25948 0,1.21882 -0.07995,2.03587 -0.241954,2.45236 -0.163113,0.42048 -0.403502,0.64106 -0.722686,0.66121 z m 0,-7.08721 c -0.119297,-0.0139 -0.235188,-0.0209 -0.347167,-0.0209 -0.699904,0 -1.256072,0.27317 -1.654787,0.82883 -0.472356,0.65841 -0.712561,1.69668 -0.712561,3.10359 0,1.30462 0.175494,2.30231 0.520222,2.98419 0.339711,0.67129 0.830339,1.07121 1.459594,1.20533 0.136971,0.66375 0.350665,1.11249 0.640348,1.34507 0.218849,0.17612 0.509866,0.26341 0.86946,0.26341 0.108619,0 0.22405,-0.008 0.345096,-0.0236 l 0.539817,-0.0538 0,-0.90379 c -0.124243,0.002 -0.348488,0.008 -0.456373,-0.002 -0.107886,-0.01 -0.213189,-0.0537 -0.280339,-0.11388 -0.120034,-0.10873 -0.210473,-0.3143 -0.270122,-0.62069 0.591837,-0.20244 1.024335,-0.63976 1.307758,-1.30816 0.278498,-0.65906 0.416435,-1.55175 0.416435,-2.68687 0,-1.23915 -0.187276,-2.18265 -0.568686,-2.84101 -0.388452,-0.67289 -0.985352,-1.06127 -1.808695,-1.1561"
sodipodi:nodetypes="cscscsccscccscscccsccczcccsccc" />
<path
inkscape:connector-curvature="0"
id="path3426"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 26.158771,393.88176 c -0.114787,0 -0.154269,-0.0362 -0.209591,-0.10965 -0.06149,-0.0802 -0.07418,-0.25876 -0.07418,-0.53629 l 0,-3.19027 0.75,0.0299 0,-0.83416 -0.75,-0.0522 0,-1.43011 L 25,387.625 l -0.297832,1.48552 -0.577168,-0.0485 0,0.89672 0.375,0.0305 0,3.53631 c 0,0.46286 0.16544,0.80026 0.353314,1.0103 0.161181,0.18128 0.408888,0.27081 0.717532,0.27081 0.04612,0 0.09453,-0.002 0.143966,-0.006 0.340816,-0.029 0.666987,-0.12133 1.035188,-0.27661 l 0,-0.8021 c -0.1841,0.0947 -0.386648,0.14865 -0.562326,0.15887 -0.0115,7.4e-4 -0.0179,9.2e-4 -0.0289,9.2e-4"
d="m 26.033771,393.88176 c -0.114787,0 -0.154269,-0.0362 -0.209591,-0.10965 -0.06149,-0.0802 -0.07962,-0.25881 -0.07418,-0.53629 l 0,-3.19027 0.75,0.0143 0,-0.83416 -0.75,-0.0366 0,-1.43011 -0.75,-0.13398 -0.297832,1.48552 -0.639668,-0.0485 0,0.89672 0.4375,0.0305 0,3.53631 c 0,0.46286 0.16544,0.80026 0.353314,1.0103 0.161181,0.18128 0.408888,0.27081 0.717532,0.27081 0.04612,0 0.09453,-0.002 0.143966,-0.006 0.340816,-0.029 0.666987,-0.12133 1.035188,-0.27661 l 0,-0.8021 c -0.1841,0.0947 -0.511648,0.14865 -0.687326,0.15887 -0.0115,7.4e-4 -0.0179,9.2e-4 -0.0289,9.2e-4"
sodipodi:nodetypes="ccsccccccccccscsccccc" />
</g>
<rect
......@@ -915,7 +915,7 @@
id="use4149"
width="1"
height="1"
transform="matrix(0.10060114,0,0,0.10060114,16.388072,-183.57956)" />
transform="matrix(0.09499217,0,0,0.09499217,17.094296,-181.71335)" />
</g>
<g
id="assistant_icon_32x32"
......@@ -938,7 +938,7 @@
y="0"
x="0" />
<use
transform="matrix(0.125,0,0,0.125,38.735113,-199.93605)"
transform="matrix(0.125,0,0,0.125,37.735113,-200.93605)"
height="1"
width="1"
id="use4145"
......@@ -994,7 +994,7 @@
id="use4030"
width="1"
height="1"
transform="matrix(0.5,0,0,0.5,131.375,-440.85176)" />
transform="matrix(0.5,0,0,0.5,125.375,-443.35176)" />
</g>
<use
x="0"
......@@ -1037,7 +1037,7 @@
y="0"
xlink:href="#qt-logo-appicon-16"
id="use4164"
transform="translate(0,-519)"
transform="translate(0,-520)"
width="1920"
height="1080" />
<use
......@@ -1055,7 +1055,7 @@
id="use4240-2"
width="1"
height="1"
transform="matrix(0.1063792,0,0,0.1063792,0.36761291,-189.20862)" />
transform="matrix(0.08658171,0,0,0.08658171,6.2471299,-179.29014)" />
</g>
<g
inkscape:export-ydpi="90"
......@@ -1068,7 +1068,7 @@
y="0"
xlink:href="#qt-logo-appicon-24"
id="use4172"
transform="translate(0,-519)"
transform="translate(0,-520)"
width="1920"
height="1080" />
<use
......@@ -1086,7 +1086,7 @@
id="use4240-8"
width="1"
height="1"
transform="matrix(0.11753005,0,0,0.11753005,21.057645,-202.84944)" />
transform="matrix(0.09169048,0,0,0.09169048,27.578857,-189.01855)" />
</g>
<g
inkscape:export-ydpi="90"
......@@ -1098,7 +1098,7 @@
y="0"
xlink:href="#qt-logo-appicon-32"
id="use4180"
transform="translate(0,-519)"
transform="translate(0,-520)"
width="1920"
height="1080" />
<use
......@@ -1116,7 +1116,7 @@
id="use4240-4"
width="1"
height="1"
transform="matrix(0.13751846,0,0,0.13751846,47.060028,-220.76689)" />
transform="matrix(0.13298217,0,0,0.13298217,47.49064,-217.59562)" />
</g>
<use
inkscape:export-ydpi="90"
......@@ -1149,7 +1149,7 @@
y="0"
xlink:href="#qt-logo-appicon-128"
id="use4192"
transform="translate(0,-515)"
transform="translate(0,-520)"
width="1920"
height="1080" />
<use
......@@ -1167,7 +1167,7 @@
id="use4240"
width="1"
height="1"
transform="matrix(0.50214455,0,0,0.50214455,178.07261,-494.13253)" />
transform="matrix(0.44916129,0,0,0.44916129,188.30305,-467.19518)" />
</g>
<use
height="1080"
......@@ -1257,7 +1257,7 @@
id="use4408-2"
width="1"
height="1"
transform="matrix(0.08076332,-0.08076332,0.08076332,0.08076332,-3.7417154,-163.4058)" />
transform="matrix(0.07759947,-0.07759947,0.07759947,0.07759947,-2.0275119,-163.70546)" />
</g>
<g
transform="translate(0,-2080)"
......@@ -1288,7 +1288,7 @@
id="use4408-7"
width="1"
height="1"
transform="matrix(0.10344368,-0.10344368,0.10344368,0.10344368,11.193778,-175.35678)" />
transform="matrix(0.10344368,-0.10344368,0.10344368,0.10344368,10.193778,-176.35678)" />
</g>
<use
x="0"
......@@ -1339,7 +1339,7 @@
id="use4408-79"
width="1"
height="1"
transform="matrix(0.34761014,-0.34761014,0.34761014,0.34761014,71.099598,-308.18429)"
transform="matrix(0.3463446,-0.34254864,0.3463446,0.34254864,63.28528,-312.46397)"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
......@@ -1429,7 +1429,7 @@
y="0"
xlink:href="#dbusviewer_arrows"
id="use4550-6"
transform="matrix(0.14825773,0,0,0.12982492,-23.834571,-196.18454)"
transform="matrix(0.14520415,0,0,0.11654081,-23.77283,-190.63165)"
width="1"
height="1" />
</g>
......@@ -1460,7 +1460,7 @@
y="0"
xlink:href="#dbusviewer_arrows"
id="use4550-3"
transform="matrix(0.18154379,0,0,0.1765106,-10.11283,-222.86328)"
transform="matrix(0.18154379,0,0,0.1765106,-11.11283,-224.86328)"
width="1"
height="1" />
</g>
......@@ -1511,7 +1511,7 @@
y="0"
xlink:href="#dbusviewer_icon"
id="use4617"
transform="matrix(0.5,0,0,0.5,56,-414)"
transform="matrix(0.5,0,0,0.5,53,-423)"
width="1"
height="1" />
</g>
......@@ -1601,7 +1601,7 @@
y="0"
xlink:href="#qmlviewer-logo-paperplane"
id="use6842-3"
transform="matrix(0.08610341,0,0,0.08610341,41.052684,-187.431)"
transform="matrix(0.07591317,0,0,0.07591317,41.310501,-181.48261)"
width="1"
height="1" />
</g>
......@@ -1632,7 +1632,7 @@
y="0"
xlink:href="#qmlviewer-logo-paperplane"
id="use6842-0"
transform="matrix(0.10786016,0,0,0.10786016,69.216377,-204.34665)"
transform="matrix(0.10052878,0,0,0.10052878,69.48104,-199.62817)"
width="1"
height="1" />
</g>
......@@ -1685,7 +1685,7 @@
id="use6842"
width="1"
height="1"
transform="matrix(0.42836676,0,0,0.42836676,249.29037,-454.98281)" />
transform="matrix(0.37652609,0,0,0.37652609,256.11156,-422.54709)" />
</g>
<use
x="0"
......@@ -1773,7 +1773,7 @@
y="0"
xlink:href="#qtcreator-logo-leaf"
id="use4579-5"
transform="matrix(0.0911153,0,0,0.0911153,-8.49472,-177.13152)"
transform="matrix(0.0796062,0,0,0.0796062,-1.3527167,-171.81739)"
width="1"
height="1" />
</g>
......@@ -1804,7 +1804,7 @@
y="0"
xlink:href="#qtcreator-logo-leaf"
id="use4579-7"
transform="matrix(0.1139269,0,0,0.1139269,7.1916443,-191.43434)"
transform="matrix(0.1139269,0,0,0.1139269,6.1916443,-192.43434)"
width="1"
height="1" />
</g>
......@@ -1855,7 +1855,7 @@
y="0"
xlink:href="#qtcreator-logo-leaf"
id="use4579-6"
transform="matrix(0.46767572,0,0,0.46767572,-4.050368,-413.23654)"
transform="matrix(0.44178025,0,0,0.44178025,11.274994,-405.05194)"
width="1"
height="1" />
</g>
......@@ -2378,7 +2378,7 @@
style="display:inline"
id="qtcreator-logo-leaf">
<path
style="fill:#b4b4b4;fill-opacity:1;stroke:#ffffff;stroke-width:0.25000000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
style="fill:#b4b4b4;fill-opacity:1;stroke:none;stroke-width:0.25000000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 24.360144,599.91797 c 0,0 -1.180704,-2.9808 0.17111,-4.35547 1.351814,-1.37467 4.480985,-1.78019 7.03125,-4.875 -1.33283,3.62826 -1.079399,5.25815 -2.546875,7.39063 -1.467476,2.13247 -4.655485,1.83984 -4.655485,1.83984 z"
id="path3357"
inkscape:connector-curvature="0"
......@@ -2410,7 +2410,7 @@
inkscape:connector-curvature="0"
id="path6773"
d="M 2,741 172.5,626 c -5,40 -3.5,98 -3.5,154 -18.15246,-10.35573 -37.70839,-21.6529 -52,-23 L 77,775 64.646447,745.35355 C 45.291043,740.73103 23.986115,740.3611 2,741 z"
style="fill:#929292;fill-opacity:1;stroke:#ffffff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
style="fill:#929292;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
......
#!/bin/sh
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and Digia. For licensing terms and
## conditions see http://www.qt.io/licensing. For further information
## use the contact form at http://www.qt.io/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 2.1 or version 3 as published by the Free
## Software Foundation and appearing in the file LICENSE.LGPLv21 and
## LICENSE.LGPLv3 included in the packaging of this file. Please review the
## following information to ensure the GNU Lesser General Public License
## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
# http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## In addition, as a special exception, Digia gives you certain additional
## rights. These rights are described in the Digia Qt LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
#############################################################################
# This script creates several application icon files by using
# Inkscape to rasterize .svg items to .png, adding shadows via
# imagemagick, creating .ico files via imagemagick and .icns
# files via iconutil (OSX only).
# Inkscape is required by this script
if ! hash inkscape 2>/dev/null; then
echo "Inkscape was not found in PATH" >&2
exit 1
fi
# Imagemagick convert is required by this script
if ! hash convert 2>/dev/null; then
echo "Imagemagick convert was not found in PATH" >&2
exit 1
fi
cd `dirname $0`
applicationNames="qtcreator designer linguist assistant qdbusviewer qmlviewer"
applicationIconDimensions="16:0 24:0 32:1 48:1 64:1 128:2 256:3 512:7 1024:15"
# Creating the list of svg IDs to export
for applicationName in $applicationNames;\
do
for applicationIconDimension in $applicationIconDimensions;\
do
applicationIconSize=`echo $applicationIconDimension | awk -F: '{ print $1 }'`
iconIDs="${iconIDs} ${applicationName}_icon_${applicationIconSize}x${applicationIconSize}"
done
done
# Adding the icons for the OSX document type icon for .ui files
for uiFileIconSize in 16 32 128 256 512;\
do
uiFileIconID=uifile_icon_${uiFileIconSize}x${uiFileIconSize}
uiFileIconIDs="${uiFileIconIDs} ${uiFileIconID} ${uiFileIconID}@2x"
done
iconIDs="${iconIDs} ${uiFileIconIDs}"
# Creating the inkscape .png export commands for the iconIDs and executing them in one go
for iconID in $iconIDs;\
do
inkscapeCommands="${inkscapeCommands}\napplicationicons.svg --export-id=${iconID} --export-id-only --export-png=${iconID}.png"
done
echo -e $inkscapeCommands | inkscape --shell
# Adding the shadows to the .png files
for applicationName in $applicationNames;\
do
for applicationIconDimension in $applicationIconDimensions;\
do
iconSize=`echo $applicationIconDimension | awk -F: '{ print $1 }'`
shadowSize=`echo $applicationIconDimension | awk -F: '{ print $2 }'`
iconFile=${applicationName}_icon_${iconSize}x${iconSize}.png
if [ "$shadowSize" != "0" ]
then
convert -page ${iconSize}x${iconSize} ${iconFile} \( +clone -background black -shadow 25x1+0+0 \) +swap -background none -flatten ${iconFile}
convert -page ${iconSize}x${iconSize} ${iconFile} \( +clone -background black -shadow 40x${shadowSize}+0+${shadowSize} \) +swap -background none -flatten ${iconFile}
fi
done
done
# Creating the .ico files
iconSizes="256 128 64 48 32 24 16"
for applicationName in $applicationNames;\
do
icoFiles=""
for iconSize in $iconSizes;\
do
icoFiles="$icoFiles ${applicationName}_icon_${iconSize}x${iconSize}.png"
done
convert ${icoFiles} ${applicationName}.ico
done
# Preparing application .iconsets for the conversion to .icns
for applicationName in $applicationNames;\
do
inconsetName=${applicationName}.iconset
rm -rf $inconsetName
mkdir $inconsetName
cp ${applicationName}_icon_16x16.png ${inconsetName}/icon_16x16.png
cp ${applicationName}_icon_32x32.png ${inconsetName}/icon_32x32.png
cp ${applicationName}_icon_128x128.png ${inconsetName}/icon_128x128.png
cp ${applicationName}_icon_256x256.png ${inconsetName}/icon_256x256.png
cp ${applicationName}_icon_512x512.png ${inconsetName}/icon_512x512.png
cp ${applicationName}_icon_32x32.png ${inconsetName}/icon_16x16@2x.png
cp ${applicationName}_icon_64x64.png ${inconsetName}/icon_32x32@2x.png
cp ${applicationName}_icon_256x256.png ${inconsetName}/icon_128x128@2x.png
cp ${applicationName}_icon_512x512.png ${inconsetName}/icon_256x256@2x.png
cp ${applicationName}_icon_1024x1024.png ${inconsetName}/icon_512x512@2x.png
done
# Prepaing the document type .iconset
uiFileIconsetName=uifile_icon.iconset/
rm -rf $uiFileIconsetName
mkdir $uiFileIconsetName
for uiFileIconID in $uiFileIconIDs;\
do
targetFileName=`echo $uiFileIconID | cut -c 8-`
cp ${uiFileIconID}.png ${uiFileIconsetName}/${targetFileName}.png
done
# Convertion the .iconsets to .icns files
# iconutil is only available on OSX
if hash iconutil 2>/dev/null; then
for applicationName in $applicationNames;\
do
iconutil -c icns ${applicationName}.iconset
done
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment