Please don't create a new instance of Imagine in the filter. It does not make any sense and forbids using the filter with other implementations than GD.