I use ImageMagick and need to do conditional resize of images.
For that I store results of the
identify tool into variables.
$infile='test.jpg' width=$(identify -ping -format %w $infile) height=$(identify -ping -format %h $infile)
But before resizing I want to do some transformations that change image size:
-shave. So I need to calculate image size in between of trimming and resizing. And I'd like to do the trim operation only once to make a little optimization.
So, I'd like:
- to do trim and shave
- store [binary] result in a variable (for example:
$datavariable value as input to
identifytool and store its result for conditional resizing
converttool and finish processing
Something like this:
data=$(convert logo: -shave 1x1 gif:-) width=$(echo $data | identify -ping -format %w gif:-) echo $data | convert -resize "$width"
echo doesn't work as needed.
identify are tools from ImageMagick suite