C# Class QualityBot.Util.ImageUtil

Afficher le fichier Open project: Ancestry/quality-bot

Méthodes publiques

Méthode Description
Base64ToBytes ( string base64 ) : byte[]

Converts a base 64 encoded string to a byte array.

Base64ToImage ( string base64 ) : Image

Converts a base 64 encoded string to an image.

BitmapDiff ( Bitmap bitmapA, Bitmap bitmapB, ImageAttributes ia, decimal &percentageDifferent ) : Bitmap

Compares two bitmaps pixel-by-pixel and returns a bitmap mask of the difference.

BytesToBase64 ( byte bytes ) : string

Converts a byte array to a base 64 encoded string.

BytesToImage ( byte imageBytes ) : Image

Converts a byte array to an image.

CropImage ( Image image, Rectangle cropArea ) : Image

Crops the image to the specified rectangle.

DrawRegionAsMasks ( Size size, Region region, Image image, ImageAttributes ia ) : Bitmap

Draws the region as green, and the inverted region as red.

GetClippedImage ( Size size, Image image, Region region ) : Bitmap

Clips an image to the specified region.

GetClippedRegion ( Rectangle rectangle, IEnumerable potentialIntersections ) : Region

Calculates the region of the rectangle that is not overlapped by siblings or children.

ImageToBase64 ( Image image, ImageFormat format ) : string

Converts an image to a base 64 encoded string.

ImageToBytes ( Image image, ImageFormat format ) : byte[]

Converts an image to a byte array.

IsColorMatch ( Color color1, Color color2 ) : bool

Determines if two colors are equivalent.

SaveImageToDisc ( string outputDir, string base64Image, string imageSuffix ) : string

Saves the specified image to disc.

Method Details

Base64ToBytes() public static méthode

Converts a base 64 encoded string to a byte array.
public static Base64ToBytes ( string base64 ) : byte[]
base64 string The base 64 encoded image.
Résultat byte[]

Base64ToImage() public static méthode

Converts a base 64 encoded string to an image.
public static Base64ToImage ( string base64 ) : Image
base64 string The base 64 encoded image.
Résultat Image

BitmapDiff() public static méthode

Compares two bitmaps pixel-by-pixel and returns a bitmap mask of the difference.
public static BitmapDiff ( Bitmap bitmapA, Bitmap bitmapB, ImageAttributes ia, decimal &percentageDifferent ) : Bitmap
bitmapA System.Drawing.Bitmap The first bitmap.
bitmapB System.Drawing.Bitmap The second bitmap.
ia System.Drawing.Imaging.ImageAttributes The image attributes.
percentageDifferent decimal The difference between the two images as a percentage.
Résultat System.Drawing.Bitmap

BytesToBase64() public static méthode

Converts a byte array to a base 64 encoded string.
public static BytesToBase64 ( byte bytes ) : string
bytes byte The byte array.
Résultat string

BytesToImage() public static méthode

Converts a byte array to an image.
public static BytesToImage ( byte imageBytes ) : Image
imageBytes byte The byte array.
Résultat Image

CropImage() public static méthode

Crops the image to the specified rectangle.
public static CropImage ( Image image, Rectangle cropArea ) : Image
image Image The image.
cropArea System.Drawing.Rectangle The cropping rectangle.
Résultat Image

DrawRegionAsMasks() public static méthode

Draws the region as green, and the inverted region as red.
public static DrawRegionAsMasks ( Size size, Region region, Image image, ImageAttributes ia ) : Bitmap
size System.Drawing.Size The size of the image.
region System.Drawing.Region The clipping region.
image Image The image.
ia System.Drawing.Imaging.ImageAttributes The iamge attributes (such as alpha blending) to use when drawing the masks.
Résultat System.Drawing.Bitmap

GetClippedImage() public static méthode

Clips an image to the specified region.
public static GetClippedImage ( Size size, Image image, Region region ) : Bitmap
size System.Drawing.Size The size of the image.
image Image The image.
region System.Drawing.Region The region to clip.
Résultat System.Drawing.Bitmap

GetClippedRegion() public static méthode

Calculates the region of the rectangle that is not overlapped by siblings or children.
public static GetClippedRegion ( Rectangle rectangle, IEnumerable potentialIntersections ) : Region
rectangle System.Drawing.Rectangle The rectangle.
potentialIntersections IEnumerable An array of potentially intersecting rectangles.
Résultat System.Drawing.Region

ImageToBase64() public static méthode

Converts an image to a base 64 encoded string.
public static ImageToBase64 ( Image image, ImageFormat format ) : string
image Image The image.
format System.Drawing.Imaging.ImageFormat The image format.
Résultat string

ImageToBytes() public static méthode

Converts an image to a byte array.
public static ImageToBytes ( Image image, ImageFormat format ) : byte[]
image Image The image.
format System.Drawing.Imaging.ImageFormat The image format.
Résultat byte[]

IsColorMatch() public static méthode

Determines if two colors are equivalent.
public static IsColorMatch ( Color color1, Color color2 ) : bool
color1 Color The first color.
color2 Color The second color.
Résultat bool

SaveImageToDisc() public static méthode

Saves the specified image to disc.
public static SaveImageToDisc ( string outputDir, string base64Image, string imageSuffix ) : string
outputDir string The target directory.
base64Image string The image as a base64 encoded string.
imageSuffix string The filename suffix.
Résultat string