ImageDataCropBottom Property

Defines the fraction of picture removal from the bottom side.

Namespace:  Aspose.Words.Drawing
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public double CropBottom { get; set; }

Property Value

Type: Double
Remarks

The amount of cropping can range from -1.0 to 1.0. The default value is 0. Note that a value of 1 will display no picture at all. Negative values will result in the picture being squeezed inward from the edge being cropped (the empty space between the picture and the cropped edge will be filled by the fill color of the shape). Positive values less than 1 will result in the remaining picture being stretched to fit the shape.

The default value is 0.

Examples
Shows how to edit images using the ImageData attribute.
// Open a document that contains images
Document imgSourceDoc = new Document(MyDir + "Images.docx");

Shape sourceShape = (Shape)imgSourceDoc.GetChildNodes(NodeType.Shape, true)[0];

Document dstDoc = new Document();

// Import a shape from the source document and append it to the first paragraph, effectively cloning it
Shape importedShape = (Shape)dstDoc.ImportNode(sourceShape, true);
dstDoc.FirstSection.Body.FirstParagraph.AppendChild(importedShape);

// Get the ImageData of the imported shape
ImageData imageData = importedShape.ImageData;
imageData.Title = "Imported Image";

// If an image appears to have no borders, its ImageData object will still have them, but in an unspecified color
Assert.AreEqual(4, imageData.Borders.Count);
Assert.AreEqual(Color.Empty, imageData.Borders[0].Color);

Assert.True(imageData.HasImage);

// This image is not linked to a shape or to an image in the file system
Assert.False(imageData.IsLink);
Assert.False(imageData.IsLinkOnly);

// Brightness and contrast are defined on a 0-1 scale, with 0.5 being the default value
imageData.Brightness = 0.8d;
imageData.Contrast = 1.0d;

// Our image will have a lot of white now that we've changed the brightness and contrast like that
// We can treat white as transparent with the following attribute
imageData.ChromaKey = Color.White;

// Import the source shape again, set it to black and white
importedShape = (Shape)dstDoc.ImportNode(sourceShape, true);
dstDoc.FirstSection.Body.FirstParagraph.AppendChild(importedShape);

importedShape.ImageData.GrayScale = true;

// Import the source shape again to create a third image, and set it to BiLevel
// Unlike greyscale, which preserves the brightness of the original colors,
// BiLevel sets every pixel to either black or white, whichever is closer to the original color
importedShape = (Shape)dstDoc.ImportNode(sourceShape, true);
dstDoc.FirstSection.Body.FirstParagraph.AppendChild(importedShape);

importedShape.ImageData.BiLevel = true;

// Cropping is determined on a 0-1 scale
// Cropping a side by 0.3 will crop 30% of the image out at that side
importedShape.ImageData.CropBottom = 0.3d;
importedShape.ImageData.CropLeft = 0.3d;
importedShape.ImageData.CropTop = 0.3d;
importedShape.ImageData.CropRight = 0.3d;

dstDoc.Save(ArtifactsDir + "Drawing.ImageData.docx");
See Also