Chromium Code Reviews| Index: canvas_bench/images/generate_images.sh |
| =================================================================== |
| --- canvas_bench/images/generate_images.sh (revision 0) |
| +++ canvas_bench/images/generate_images.sh (revision 0) |
| @@ -0,0 +1,25 @@ |
| +#!/bin/bash |
| +# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
jbates
2012/02/17 19:54:30
nit: 2012
|
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +# Utility to generate random images using ImageMagick |
| + |
| +MIN_DIM=75 |
| +MAX_DIM=100 |
| +NUM_IMAGES=1000 |
| + |
| +for (( i = 1; i <= NUM_IMAGES; ++i )) do |
| + # Generate a random binary 0/1. |
| + rand_bin=$(( $RANDOM % 2 )) |
| + # Generate a random number in the range [MIN_DIM, MAX_DIM]. |
| + rand_dim=$(( MIN_DIM + ($RANDOM % (MAX_DIM - MIN_DIM + 1)) )) |
| + |
| + # Generate a dimension such that one side is equal to MAX_DIM |
| + # and the other is a random number in the range [MIN_DIM, MAX_DIM]. |
| + width=$(( (rand_bin * MAX_DIM) + ((1 - rand_bin) * rand_dim) )) |
| + height=$(( ((1 - rand_bin) * MAX_DIM) + (rand_bin * rand_dim) )) |
| + |
| + # Generate a random image |
| + convert -size ${width}x${height} plasma:fractal image$i.png |
| +done |
| Property changes on: canvas_bench\images\generate_images.sh |
| ___________________________________________________________________ |
| Added: svn:executable |
| + * |
| Added: svn:eol-style |
| + LF |