diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2022-12-31 15:20:17 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2022-12-31 16:18:53 +0000 |
| commit | b403f8f97a97f9f55205d57149fd355a09727bd4 (patch) | |
| tree | b8b03a44f65fca43bf56ac1205135737463b132e /icons | |
| parent | f63810fbc89158d5637e4f554436c80140569024 (diff) | |
| download | puzzles-b403f8f97a97f9f55205d57149fd355a09727bd4.zip puzzles-b403f8f97a97f9f55205d57149fd355a09727bd4.tar.gz puzzles-b403f8f97a97f9f55205d57149fd355a09727bd4.tar.bz2 puzzles-b403f8f97a97f9f55205d57149fd355a09727bd4.tar.xz | |
Support the generation of icons from uniformly-coloured screenshots
The square.pl script removed all pixels that were the same colour as the
edge ones, even if that meant removing all of the pixels. Now it stops
removing pixels at 1x1 so that there will be something left for
ImageMagick to work on.
Diffstat (limited to 'icons')
| -rwxr-xr-x | icons/square.pl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/icons/square.pl b/icons/square.pl index 8a9a4bf..0a9352b 100755 --- a/icons/square.pl +++ b/icons/square.pl @@ -42,13 +42,13 @@ $back = $plist[0]; # Crop rows and columns off the image to find the central rectangle # of non-background stuff. $ystart = 0; -$ystart++ while $ystart < $h and scalar(grep { $_ ne $back } map { $data->[$ystart*$w+$_] } 0 .. ($w-1)) == 0; +$ystart++ while $ystart < $h - 1 and scalar(grep { $_ ne $back } map { $data->[$ystart*$w+$_] } 0 .. ($w-1)) == 0; $yend = $h-1; -$yend-- while $yend >= $ystart and scalar(grep { $_ ne $back } map { $data->[$yend*$w+$_] } 0 .. ($w-1)) == 0; +$yend-- while $yend > $ystart and scalar(grep { $_ ne $back } map { $data->[$yend*$w+$_] } 0 .. ($w-1)) == 0; $xstart = 0; -$xstart++ while $xstart < $w and scalar(grep { $_ ne $back } map { $data->[$_*$w+$xstart] } 0 .. ($h-1)) == 0; +$xstart++ while $xstart < $w - 1 and scalar(grep { $_ ne $back } map { $data->[$_*$w+$xstart] } 0 .. ($h-1)) == 0; $xend = $w-1; -$xend-- while $xend >= $xstart and scalar(grep { $_ ne $back } map { $data->[$_*$w+$xend] } 0 .. ($h-1)) == 0; +$xend-- while $xend > $xstart and scalar(grep { $_ ne $back } map { $data->[$_*$w+$xend] } 0 .. ($h-1)) == 0; # Decide how much border we're going to put back on to make the # image perfectly square. |