OLD | NEW |
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 # This adds text to our non-labeled recovery images. | 6 # This adds text to our non-labeled recovery images. |
7 # | 7 # |
8 # The source images should be 1366x800, with the expectation they'll be cropped | 8 # The source images should be 1366x800, with the expectation they'll be cropped |
9 # to 1366x768 or 1280x800, have 2 lines of text overlayed at the bottom, and | 9 # to 1366x768 or 1280x800, have 2 lines of text overlayed at the bottom, and |
10 # then be resized to 800x600 so that the BIOS can then display them stretched | 10 # then be resized to 800x600 so that the BIOS can then display them stretched |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 # Now crop that to the two target sizes | 76 # Now crop that to the two target sizes |
77 convert "$img_orig" -gravity Center \ | 77 convert "$img_orig" -gravity Center \ |
78 -crop "$geom_crop_a"+0+0 +repage "$img_crop_a" | 78 -crop "$geom_crop_a"+0+0 +repage "$img_crop_a" |
79 convert "$img_orig" -gravity Center \ | 79 convert "$img_orig" -gravity Center \ |
80 -crop "$geom_crop_b"+0+0 +repage "$img_crop_b" | 80 -crop "$geom_crop_b"+0+0 +repage "$img_crop_b" |
81 | 81 |
82 # Add the labels in | 82 # Add the labels in |
83 if [ -r "$txt_file" ]; then | 83 if [ -r "$txt_file" ]; then |
84 # Replace all '$URL' in the URL in the text file with the real url | 84 # Replace all '$URL' in the URL in the text file with the real url |
85 perl -p \ | 85 perl -p \ |
86 -e 'BEGIN {$/ = ""; $url = shift; }' \ | 86 -e 'BEGIN {$/ = undef; $url = shift; }' \ |
87 -e 'chomp; s/\$URL/$url/gse;' \ | 87 -e 's/\s+$/\n/gs; s/\$URL/$url/gs;' \ |
88 -e 'END {print "\n";}' "$url" "$txt_file" > "$label_file" | 88 "$url" "$txt_file" > "$label_file" |
89 # Render it | 89 # Render it |
90 convert "$img_crop_a" -fill white \ | 90 convert "$img_crop_a" -fill white \ |
91 -font "$font" -pointsize "$pointsize" -interline-spacing 5 \ | 91 -font "$font" -pointsize "$pointsize" -interline-spacing 5 \ |
92 -gravity south -annotate '+0+10' '@'"$label_file" "$img_txt_a" | 92 -gravity south -annotate '+0+0' '@'"$label_file" "$img_txt_a" |
93 convert "$img_crop_b" -fill white \ | 93 convert "$img_crop_b" -fill white \ |
94 -font "$font" -pointsize "$pointsize" -interline-spacing 5 \ | 94 -font "$font" -pointsize "$pointsize" -interline-spacing 5 \ |
95 -gravity south -annotate '+0+10' '@'"$label_file" "$img_txt_b" | 95 -gravity south -annotate '+0+0' '@'"$label_file" "$img_txt_b" |
96 else | 96 else |
97 mv "$img_crop_a" "$img_txt_a" | 97 mv "$img_crop_a" "$img_txt_a" |
98 mv "$img_crop_b" "$img_txt_b" | 98 mv "$img_crop_b" "$img_txt_b" |
99 fi | 99 fi |
100 | 100 |
101 # Now scale the result to the final size | 101 # Now scale the result to the final size |
102 convert "$img_txt_a" -scale "$geom_final" -alpha off "$dst_img_a" | 102 convert "$img_txt_a" -scale "$geom_final" -alpha off "$dst_img_a" |
103 convert "$img_txt_b" -scale "$geom_final" -alpha off "$dst_img_b" | 103 convert "$img_txt_b" -scale "$geom_final" -alpha off "$dst_img_b" |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 # Do it. | 107 # Do it. |
108 for file in originals/*.gif; do | 108 for file in originals/*.gif; do |
109 process_one_file "$file" | 109 process_one_file "$file" |
110 done | 110 done |
111 | 111 |
112 # Zip up the bitmaps | 112 # Zip up the bitmaps |
113 (cd "$outdir_a" && zip -qr "${thisdir}/out_${geom_crop_a}.zip" *) | 113 nicename=${url// /_} |
114 (cd "$outdir_b" && zip -qr "${thisdir}/out_${geom_crop_b}.zip" *) | 114 (cd "$outdir_a" && zip -qr "${thisdir}/out_${nicename}__${geom_crop_a}.zip" *) |
| 115 (cd "$outdir_b" && zip -qr "${thisdir}/out_${nicename}__${geom_crop_b}.zip" *) |
OLD | NEW |