summaryrefslogtreecommitdiff
path: root/lib/builder-utils.sh
diff options
context:
space:
mode:
authorMario Fetka <[email protected]>2013-03-11 18:31:52 (GMT)
committer Mario Fetka <[email protected]>2013-03-11 18:31:52 (GMT)
commit8e01c00a60793fcb4793df44ffc18a184e8fc20e (patch)
treedff786b5acdba3e7385eec0a103ce33b846ade26 /lib/builder-utils.sh
parentd7318c9306a492eee6d5d66b75f0434f896e69db (diff)
add an white border to the source image so if the images goes to the corners it will have
an white border to work on on convertiong the white to transparent
Diffstat (limited to 'lib/builder-utils.sh')
-rw-r--r--lib/builder-utils.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh
index 97c11ed..6932a41 100644
--- a/lib/builder-utils.sh
+++ b/lib/builder-utils.sh
@@ -148,12 +148,15 @@ convert_image() {
local wight=`${CMD_identify} -format "%w" $src`
${CMD_identify} -format "%wx%h" $src
+ # Add a white border to the image so that the convert to stansparent can go around an image
+ convert -bordercolor White -border 3x3 $src $OUTPUT_DIR/bigger.png
+
# first resize the image to the new aspect ratio and add white borders
if [ $wight -lt $hight ] ; then
# Its higher so force x160 and let imagemagic decide the right wight
# then add white to the rest of the image to fit 160x160
log_debug "Icon Wight: $wight < Hight: $hight"
- convert $src -colorspace RGB -resize x160 \
+ convert $OUTPUT_DIR/bigger.png -colorspace RGB -resize x160 \
-size 160x160 xc:white +swap -gravity center -composite \
-modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png
builder_check_error "converting image"
@@ -161,14 +164,14 @@ convert_image() {
# Its wider so force 160x and let imagemagic decide the right hight
# then add white to the rest of the image to fit 160x160
log_debug "Icon Wight: $wight > Hight: $hight"
- convert $src -colorspace RGB -resize 160x \
+ convert $OUTPUT_DIR/bigger.png -colorspace RGB -resize 160x \
-size 160x160 xc:white +swap -gravity center -composite \
-modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png
builder_check_error "converting image"
elif [ $wight -eq $hight ] ; then
# Its scare so force 160x160
log_debug "Icon Wight: $wight = Hight: $hight"
- convert $src -colorspace RGB -resize 160x160 \
+ convert $OUTPUT_DIR/bigger.png -colorspace RGB -resize 160x160 \
-size 160x160 xc:white +swap -gravity center -composite \
-modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png
builder_check_error "converting image"
@@ -176,7 +179,7 @@ convert_image() {
# Imagemagic is unable to detect the aspect ratio so just force 160x160
# this could result in streched images
log_debug "Icon Wight: $wight unknown Hight: $hight"
- convert $src -colorspace RGB -resize 160x160 \
+ convert $OUTPUT_DIR/bigger.png -colorspace RGB -resize 160x160 \
-size 160x160 xc:white +swap -gravity center -composite \
-modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png
builder_check_error "converting image"

Powered by Domaintechnik.at | Hosting - Domain - Webspace