The script needs to take in an image and add an automatic bleed of specified number of pixels. See attached images for a clearer explanation.
I would prefer the solution to be written in PHP using ImageMagick but solutions written in C will be considered.
If using C, please ensure that project works on a Linux installation.