public function crop( $path_to_png, $border = '20x20' ) {

		$command = PB_CONVERT_COMMAND . ' ' . escapeshellarg( $path_to_png ) . " -trim +repage -bordercolor white -border {$border} " . escapeshellarg( $path_to_png );

		// Execute command
		$output = [];
		$return_var = 0;
		exec( $command, $output, $return_var ); // @codingStandardsIgnoreLine

		if ( ! empty( $output ) ) {
			// @codingStandardsIgnoreStart
			debug_error_log( $command );
			debug_error_log( print_r( $output, true ) );
			// @codingStandardsIgnoreEnd
		}
	}
public function crop( $path_to_png, $border = '20x20' ) {

		$command = PB_CONVERT_COMMAND . ' ' . escapeshellarg( $path_to_png ) . " -trim +repage -bordercolor white -border {$border} " . escapeshellarg( $path_to_png );

		// Execute command
		$output = [];
		$return_var = 0;
		exec( $command, $output, $return_var ); // @codingStandardsIgnoreLine

		if ( ! empty( $output ) ) {
			// @codingStandardsIgnoreStart
			debug_error_log( $command );
			debug_error_log( print_r( $output, true ) );
			// @codingStandardsIgnoreEnd
		}
	}
public function crop ( $ path_to_png , $ border = '20x20' ) { $ command = PB_CONVERT_COMMAND . ' ' . escapeshellarg ( $ path_to_png ) . " -trim +repage -bordercolor white -border {$border} " . escapeshellarg ( $ path_to_png ) ; // Execute command $ output = [ ] ; $ return_var = 0 ; exec ( $ command , $ output , $ return_var ) ; // @codingStandardsIgnoreLine if ( ! empty ( $ output ) ) { // @codingStandardsIgnoreStart debug_error_log ( $ command ) ; debug_error_log ( print_r ( $ output , true ) ) ; // @codingStandardsIgnoreEnd } }
Use ImageMagick to automatically crop & pad a PNG file with a white border

@param string $path_to_png
@param string $border
Use ImageMagick to automatically crop & pad a PNG file with a white border