Skip to content
Discussion options

You must be logged in to vote

After reading some docs, final code is little tricky (for my opinion):

public static MagickImage AddBorder(this MagickImage image, int borderSize, VirtualPixelMethod pixelMethod)
{
	image.VirtualPixelMethod = pixelMethod;
	image.FilterType = FilterType.Point;
	image.SetArtifact("distort:viewport", $"{image.Width + borderSize * 2}x{image.Height + borderSize * 2}-{borderSize}-{borderSize}");
	image.Distort(DistortMethod.ScaleRotateTranslate, 0);
	image.RemoveArtifact("distort:viewport");
	image.RePage();
	return image;
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by AN3Orik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants