OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 # Utility to generate random images using ImageMagick |
| 7 |
| 8 MIN_DIM=75 |
| 9 MAX_DIM=100 |
| 10 NUM_IMAGES=1000 |
| 11 |
| 12 for (( i = 1; i <= NUM_IMAGES; ++i )) do |
| 13 # Generate a random binary 0/1. |
| 14 rand_bin=$(( $RANDOM % 2 )) |
| 15 # Generate a random number in the range [MIN_DIM, MAX_DIM]. |
| 16 rand_dim=$(( MIN_DIM + ($RANDOM % (MAX_DIM - MIN_DIM + 1)) )) |
| 17 |
| 18 # Generate a dimension such that one side is equal to MAX_DIM |
| 19 # and the other is a random number in the range [MIN_DIM, MAX_DIM]. |
| 20 width=$(( (rand_bin * MAX_DIM) + ((1 - rand_bin) * rand_dim) )) |
| 21 height=$(( ((1 - rand_bin) * MAX_DIM) + (rand_bin * rand_dim) )) |
| 22 |
| 23 # Generate a random image |
| 24 convert -size ${width}x${height} plasma:fractal image$i.png |
| 25 done |
OLD | NEW |