implement crop to fit with GD