Get just the best image in multiple image files like icons
Posted: 2019-03-08T09:27:57-07:00
Hi,
I'm not very good in use of ImageMagick, so I need some help
I inherited from a previous coworker a huge library of icons. The problem is that many of them are very old and, hence, useless nowadays.
I'd like to put aside the old ones and keep just the modern ones.
In order to do that I developed a script which prepends to the original icon name the size and color depth in square brackets, so that for example the file MyIcon.ico becomes [48x48 8] - MyIcon.ico
I use identify -format "%wx%h %z in my script
My problem arises when the icon contains several images inside.
In these cases I get a multiple output, so that, for example identify -format "%wx%h %z|" myicon1.ico (the | in format is used to clarify the output) returns:
48x48 8|32x32 8|24x24 8|16x16 8|256x256 8|256x256 8|128x128 8|96x96 8|72x72 8|64x64 8|48x48 8|32x32 8|24x24 8|16x16 8|
I would like to pick just the 256x256 8 entry, but I don't know if there is any way to do this like sorting the output or similar.
I use ImageMagick 7.0.8-32 Q16 x64 2019-03-05 on Windows
Thanks in advance
Stefano
I'm not very good in use of ImageMagick, so I need some help
I inherited from a previous coworker a huge library of icons. The problem is that many of them are very old and, hence, useless nowadays.
I'd like to put aside the old ones and keep just the modern ones.
In order to do that I developed a script which prepends to the original icon name the size and color depth in square brackets, so that for example the file MyIcon.ico becomes [48x48 8] - MyIcon.ico
I use identify -format "%wx%h %z in my script
My problem arises when the icon contains several images inside.
In these cases I get a multiple output, so that, for example identify -format "%wx%h %z|" myicon1.ico (the | in format is used to clarify the output) returns:
48x48 8|32x32 8|24x24 8|16x16 8|256x256 8|256x256 8|128x128 8|96x96 8|72x72 8|64x64 8|48x48 8|32x32 8|24x24 8|16x16 8|
I would like to pick just the 256x256 8 entry, but I don't know if there is any way to do this like sorting the output or similar.
I use ImageMagick 7.0.8-32 Q16 x64 2019-03-05 on Windows
Thanks in advance
Stefano