SIPS: Only Resize if Image is 315x300?
Here is a bash script to check the size before : 

#!/bin/bash

#theFile given in input   
theFile=$1          

#using sips to retrieve the width &amp; height            
size=($(sips -g pixelWidth -g pixelHeight theFile | grep -o '[0-9]*$'))                      

#the size you want
width=315                                                                                       
height=300

if [[ ${size[0]} -eq $width &amp;&amp; ${size[1]} -eq $height ]]; then                                    
    #put here your command for files that are 315*300                                                         
fi