Merge lp:~mvo/archive-index/app-install-mvo into lp:archive-index/app-install

Proposed by Michael Vogt
Status: Merged
Merged at revision: 5
Proposed branch: lp:~mvo/archive-index/app-install-mvo
Merge into: lp:archive-index/app-install
Diff against target: 113 lines (+57/-5)
2 files modified
postprocess-app-metadata (+11/-1)
utils/package-metadata (+46/-4)
To merge this branch: bzr merge lp:~mvo/archive-index/app-install-mvo
Reviewer Review Type Date Requested Status
Jjed Approve
Review via email: mp+70271@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

I played with pngcrush as well but did not manage to get a real reduction of the size:

+ if ! pngcrush $new_name ../icons/$new_name; then
+ echo " pngcrunch!, copying instead"
+ cp $new_name ../icons/

For each converted svg, xpm and all exisiting pngs. I compared the two dirs:

20428 icons
18852 icons-pngcrunch-reduced

That is not really great for the amount of time that pngcrush churns.

Revision history for this message
Michael Vogt (mvo) wrote :

I added a resize now for bigger icons to the target size, that gained another megabyte for size 128 and for size 64 brought the uncompressed size down to 14 mb for the icons.

7. By Michael Vogt

resize all big icons to target size

8. By Michael Vogt

utils/package-metadata: set size to 64px, use pngcrush after everything is finished

Revision history for this message
Michael Vogt (mvo) wrote :

I added a targetsize of 64px and added pngcrush (does not gain much, but every bit counts) and this brings the size down to 7.8mb compressed with gzip. This is comparable to the old size, but we have 300 icons more :) So all in all I think this is a clear winner now.

Revision history for this message
Jjed (jjed) wrote :

Thanks for this. Have merged with a dependency sanity check, will repropose my new-extract branch once I resolve the ardour namespace collision problem.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'postprocess-app-metadata'
--- postprocess-app-metadata 2011-06-29 16:33:50 +0000
+++ postprocess-app-metadata 2011-08-03 18:01:44 +0000
@@ -13,7 +13,10 @@
13 Option("-c", "--config-dir", dest="config_dir", default="config/",13 Option("-c", "--config-dir", dest="config_dir", default="config/",
14 help="directory with ArchiveCache blacklists and transforms"),14 help="directory with ArchiveCache blacklists and transforms"),
15 Option("-o", "--output-dir", dest="out_dir", default="output/",15 Option("-o", "--output-dir", dest="out_dir", default="output/",
16 help="directory where extract-app-metadata outputed"))16 help="directory where extract-app-metadata outputed"),
17 Option("-v", "--verbose", default=False, action="store_true",
18 help="show more output to stdout"),
19 )
1720
1821
19def postprocess_metadata(config_dir, out_dir):22def postprocess_metadata(config_dir, out_dir):
@@ -100,4 +103,11 @@
100 parser.print_usage()103 parser.print_usage()
101 print("extraneous arguments: {0}".format(" ".join(args)))104 print("extraneous arguments: {0}".format(" ".join(args)))
102 sys.exit(1)105 sys.exit(1)
106
107 # create output on stdout
108 if opts.verbose:
109 log = logging.getLogger()
110 handler = logging.StreamHandler()
111 log.addHandler(handler)
112
103 postprocess_metadata(opts.config_dir, opts.out_dir)113 postprocess_metadata(opts.config_dir, opts.out_dir)
104114
=== modified file 'utils/package-metadata'
--- utils/package-metadata 2011-06-29 16:33:50 +0000
+++ utils/package-metadata 2011-08-03 18:01:44 +0000
@@ -1,5 +1,7 @@
1#!/bin/bash1#!/bin/bash
22
3set -e
4
3echo "running package-metadata...."5echo "running package-metadata...."
46
5# we need this to create PNGS from scalables7# we need this to create PNGS from scalables
@@ -8,29 +10,69 @@
8 exit 110 exit 1
9fi11fi
1012
13SIZE=64
14
11cd output/icons/15cd output/icons/
12SVGS=`file -Nz * | grep "SVG" | cut -d ":" -f 1`16SVGS=`file -Nz * | grep "SVG" | cut -d ":" -f 1`
17XPMS=`file -Nz * | grep "X pixmap image" | cut -d ":" -f 1`
13SVGS_WC=`echo $SVGS | wc -w`18SVGS_WC=`echo $SVGS | wc -w`
19XPMS_WC=`echo $XPMS | wc -w`
14ICONS_WC=`ls | wc -w`20ICONS_WC=`ls | wc -w`
1521
16echo "$SVGS_WC out of $ICONS_WC output icons are scalable"22echo "$SVGS_WC out of $ICONS_WC output icons are scalable"
23echo "$XPMS_WC out of $ICONS_WC output icons are xpms"
17echo "converting to PNGs..."24echo "converting to PNGs..."
1825
19# don't delete SVGs while converting26# don't delete SVGs while converting
20mkdir -p ../backup/27mkdir -p ../backup/
21mv $SVGS ../backup/28if [ -n "$SVGS" ]; then
29 mv $SVGS ../backup/
30fi
31if [ -n "$XPMS" ];then
32 mv $XPMS ../backup/
33fi
22cd ../backup/34cd ../backup/
2335
36# conver the svgs
24for svg in $SVGS; do37for svg in $SVGS; do
25 echo " * $svg"38 echo " * $svg"
26 rsvg -w 128 $svg ../icons/${svg%%.svg*}.png39 if ! rsvg -w $SIZE $svg ../icons/${svg%%.svg*}.png; then
27 if [ $? -ne 0 ]; then
28 echo " failed!, copying instead"40 echo " failed!, copying instead"
29 cp $svg ../icons/41 cp $svg ../icons/
30 fi42 fi
31done43done
3244
33cd ..45# convert the xpms
46for xpm in $XPMS; do
47 echo " * $xpm"
48 if ! convert $xpm ../icons/${xpm%%.xpm*}.png; then
49 echo " failed!, copying instead"
50 cp $xpm ../icons/
51 fi
52done
53cd ..
54
55# resize all the big ones to our target size
56cd icons
57for png in *.png; do
58 w=$(identify -format "%[fx:w]" $png)
59 #h=$(identify -format "%[fx:h]")
60 if [ "$w" -gt $SIZE ]; then
61 echo " * resizing $png from width $w to $SIZE"
62 mv $png ../backup
63 if ! convert -resize $SIZE ../backup/$png $png; then
64 echo " resize failed, copying"
65 cp ../backup/$png $png
66 fi
67 fi
68done
69cd ..
70
71# and run pngcrush
72mkdir -p icons-reduced
73pngcrush -q -d icons-reduced icons/*.png
74mv icons-reduced/*.png icons/
75
34echo "done compressing. now archive everything"76echo "done compressing. now archive everything"
35DATE=`date '+%Y%m%d'`77DATE=`date '+%Y%m%d'`
36tar czf ../archive-metadata-$DATE.tar.gz desktop/ icons/78tar czf ../archive-metadata-$DATE.tar.gz desktop/ icons/

Subscribers

People subscribed via source and target branches

to all changes: