Tuesday, July 30, 2024

How do you work with image files in PyCharm - Part 1?

 Exploring image properties with PyCharm IDE

The image properties of a test image will be the target of our image exploration. In this part we create a project and bring in an image to the project.

Part 1: We create a PyCharm project and bring in an image into the project.

At first we create a new project in the PyCharm IDE. Here are some screenshots of creating a project.
File -> New Project brings up the next screen.


Change the name of the project to exploreImage.


Click create to create your project. You may get this screen. Choose New Window. Note that each project is usually window based. If you choose This Window, you will be adding the newly created project to another projects window.


Now imageExplore is the only project in the window that is open.


This is the default structure of a PyCharm project. It has a .venv directory and the main.py python program. This is the main entry point of the project. This has the initial logic and execution flow. It can be renamed and do not remove it. The .venv isolates your project and its dependencies from the other projects. The Scripts folder in .venv has many executable programs in addition to the python executable and other packages. You will learn a lot more about the project folder as we go through in due course.

Now we would like to create a new folder called Images wherein we place our images. It can be called in any way you choose to name.

Highlighting the exploreImage project a left click of the mouse brings up the following. Choose New -> Directory.


This should add a New Directory you can provide a custom name as shown.


However, the program does not create a new directory which it should. Even after exiting the PyCharm and reopening did not create the new directory.
Note: There  is some problem with PyCharm. However, we can create a directory using the file system in the Windows Explorer.

This is a short and sweet way to share: Just copy the below link and send it to your friends






No comments: