How an Image is Formed, in Nature and in Photography
Let's see how an image is formed from rays of light reflected off objects
For an image to be formed, first of all some light is needed, which is produced by a light source. The most common light is of course sunlight. Here the Sun illuminates Not V of M, who, as we say, is directly illuminated. She is taking a full sunbath…

Every object that receives rays from a light source reflects them into the surrounding space.

Some of the rays reflected from an object may fall on another object. This other object is said to be illuminated by reflection and not directly. Here, the rays reflected from Not V of M illuminate an opposite wall.

Each single point of an object sends many rays in many directions, but only one light ray in each unique direction. Thus, it 'prints' its image many times on a surface.

Of course, the image of each single point is very small, so small that we cannot see it as a complete picture

Just as one point created many images of itself on the opposite surface, so do all the other points of the object that reflect the light. And so we have many images falling on top of each other.

So, as the images of many points fall on the images of other points, we end up with no image being able to be formed clearly, and a chaotic situation is created, what we call a blur.

From Chaos to Image
If, between the object reflecting the light and the surface receiving the reflected light, we insert another surface, which has a very small hole, we will be able to limit the beam of rays that reaches the opposite surface, and ideally, to allow only one ray to reach there. In this way, we get a fairly clear image of a single point.

Just because the same will happen with all the other points of the object that will send their rays through the same hole, the result will be that we will have a single image point for each unique point of the object and overall we will end up getting the entire image of this object, now clear, sharp, on the surface on which the light is reflected.

Notice here that for very obvious reasons the image formed on this surface, is inverted. Every image formed in this way, whatever the system, is formed inverted

Camera Obscura & the Pinhole Box
This phenomenon existed in nature and was always known to people. One only needs to stand inside a cave that has a narrow opening, on a sunny day, to observe it. He will see an image of the outside on the wall of the cave, opposite the opening.
Later, people thought of reproducing this phenomenon, they built buildings similar to this cave, where a small opening projected the external image onto an opposite wall. In addition, many small such openings created many corresponding images inside this building. This construction was called Camera Obscura and we can now see it in many places around the planet. A little research on the internet gives us quite a lot of such evidence.

Another variation of the Camera Obscura was later used for painting. People would sketch the projection on the wall or on paper. And later, with a smaller version, they would capture the projection on photographic material. Even today, such a construction is used and we call it the Pinhole Camera.
