Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Easily Use A Popular Python Image Library In A Delphi Windows GUI App

One of the key features of Python4Delphi is the ability to use the existing Python Libraries in your Delphi/C++Builder Application with minimal code. How to import and use the existing Python Library in your Delphi application? This post will help to understand with a Python4Delphi Sample App which imports the Python Image Library(Pillow) and perform simple Image processing task quickly.

Delphi itself offers a number of advanced image manipulation capabilities through TImage in VCL and through TImage and the effects library in FMX If you have an existing Python application and you need to manipulate images you could use the Pillow library or you could send the image to Delphi and manipulate it there. Alternately, you could manipulate the image via Pillow and then display it in the Delphi Windows GUI app. You can use Python4Delphi a number of different ways such as:

Python4Delphi Demo29 Sample App shows how to import a Python Image Library(PIL) and manipulate to rotate a simple image to 90 degrees using the module API. You can find the Demo29 source on GitHub.

Prerequisites: Download and install the latest Python for your platform. Follow the Python4Delphi installation instructions mentioned here. Alternatively, you can check out this video Getting started with Python4Delphi. You should install the Pillow using the command ‘pip install Pillow’. Check more about installing python packages here.

Components used in Python4Delphi Demo29 Sample App:

You can find the Python4Delphi Demo29 sample project from the extracted repository ..Python4DelphiDemosDemo29.dproj. Open this project in RAD Studio 10.4.1 and run the application.

Find out why Python GUI is an ideal language for novices and experienced programmers alike.

Implementation Details:

[crayon-6767d7611d9e6023789333/]

The script used to process the image is shown below.

[crayon-6767d7611d9ee760400009/]
<strong>Python4Delphi Demo29<strong>

Exit mobile version