filter -> getSize() moved outside of the loop
local variable added for input -> width and input -> height