After debugging, I found a working version of gif processing

But cropping is weird. It crops the image but pads it if the aspect ratio is different. Something to work on in the future.