Get Images/Pictures Size In Excel using Python via .Net
Using Aspose.Cells’ API to work with various objects without any software like Microsoft or Open Office, Adobe PDF, etc.
How to get images/pictures size in Excel File using Python via .Net
In order to get images/pictures size in Excel File, we’ll use
Aspose.Cells for Python via .Net
API which is a feature-rich, powerful and easy to use document manipulation API for Python via .Net platform.The API provides Excel file creation, manipulation, conversion and rendering. All without relying on Microsoft Office or Excel applications.You can install from the console using the following command.
Command
> pip install aspose-cells-python
Steps to get images/pictures size in Excel file using Python via .Net
You need the Aspose.Cells to try the following workflow in your own environment.
- Loading the XLSX file with full path.
- Select Worksheet via its index.
- Select picture object via its index from ‘pictures’ attribute of Worksheet.
- There are various ways to get the size from a selected picture object.The parts are listed below, for more information, please refer to
MORE
.Notice:‘Width’ and ‘Height’ are the dimensions shown in the excel may be larger or smaller than the original picture.
- Width Represents the width of shape, in unit of pixels.
- Height Represents the height of shape, in unit of pixel.
- OriginalWidth Gets the original width of the picture, in unit of pixels.
- OriginalHeight Gets the original height of the picture, in unit of pixels.
System Requirements
Aspose.Cells for Python via .Net is platform-independent API and can be used on any platform (Windows, Linux), just make sure that system have Python 3.7 or higher.
- Any operating system that can run Python via .Net scripts, such as Windows, Linux
- Install Aspose.Cells for Python via .Net from pypi, use command as:
$ pip install aspose-cells-python
.
There are also two size-related attributes ‘width_scale’ and ‘height_scale’, which respectively represent the percentages of the current display width and height to the actual width and height. It should be noted that there is a certain error in these two attribute values, please do not use them in the case of high precision requirements.
The following code sample demonstrates how to get the size and display zoom ratio of an image/picture.