PNG JPG BMP TIFF XLSX
Aspose.Cells  for Python via Java

Get Images/Pictures Size In Excel using Python via Java

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 Java

In order to get images/pictures size in Excel File, we’ll use

Aspose.Cells for Python via Java

API which is a feature-rich, powerful and easy to use document manipulation API for Python via Java 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

Steps to get images/pictures size in Excel file using Python via Java

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 Java is platform-independent API and can be used on any platform (Windows, Linux and MacOS), just make sure that system have Java 1.8 or higher, Python 3.5 or higher.

  • Any operating system that can run Python via Java scripts, such as Windows, Linux and MacOS
  • Install Java and add it to PATH environment variable, for example: PATH=C:\Program Files\Java\jdk1.8.0_131;.
  • Install Aspose.Cells for Python via Java from pypi, use command as: $ pip install aspose-cells.

There are also two size-related attributes ‘getWidthScale()’ and ‘getHeightScale()’, 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.

 

Get size of images/pictures - Python via Java

 
  • About Aspose.Cells API

    Aspose.Cells API capable of building cross-platform applications ,can be used to create, edit, convert and render Microsoft Excel formats to different formats(as images, PDF, HTML, ODS and more).Moreover, it can be used for comprehensive charting, scalable reporting and reliable calculations within software applications.Thus making it a perfect choice to exchange documents in industry-standard formats. It’s important that Aspose.Cells is a standalone API and it does not require any software like Microsoft or OpenOffice.