Outils pour utilisateurs

Outils du site


issue153:krita

Ceci est une ancienne révision du document !


This series is aimed at learning to make something of the old photos in my possession, and others in the public domain due to their age. You, the reader, are welcome to tag along, and, I hope, glean some small insight and perhaps an idea or two from time to time. No promises are made as to quality of the content, or potential errors and omissions. I am a computer scientist, not a true artist or a professional of image restoration. So please take all this as a best effort, but with no firm guarantees — much as is the case of most open-source software. In this part of this series, we will continue work on a simple landscape, a photo of the castle of Foix in southern France. With the passage of time, this photo is now stated to fall within the public domain, has already been digitized by the Rosalis project of the municipal public library of Toulouse, and may be downloaded from Wikicommons at address: https://commons.m.wikimedia.org/wiki/File:Ch%C3%A2teau_en_ruines_(8056081904).jpg .

Cette série a pour but d'apprendre à faire quelque chose des vieilles photos en ma possession, et d'autres du domaine public du fait de leur âge. Vous, lecteur, êtes bienvenu pour m'accompagner, et j'espère glaner quelques petites particularités et une idée ou deux de temps à autre. Je ne fais aucune promesse sur la qualité du contenu, ou sur les erreurs et omissions possibles. Je suis un scientifique en informatique, pas un artiste ou un vrai professionnel de la restauration des images. Aussi, merci de considérer ça comme mon meilleur effort, mais sans garanties fermes, comme c'est souvent le cas dans les logiciels Open Source.

Dans cette partie de la série, nous commencerons notre travail sur un simple paysage, une photo du château de Foix dans le sud de la France, au début du 20e siècle. Avec le temps, cette photo est tombée dans le domaine public, elle a été numérisée par le projet Rosalis de la bibliothèque municipale de Toulouse et peut être téléchargée à partir de Wikicommons à l'adresse : https://commons.m.wikimedia.org/wiki/File:Ch%C3%A2teau_en_ruines_(8056081904).jpg

In the previous episode, we cropped the image slightly to remove some damage along the lower and left edges, used the airbrush to clean up more damage near the top edge and some typical dark spots that were quite apparent on the clear sky, and then an overlay layer along with a dark color and the airbrush to reduce the effect of a large whitish blemish in the lower left corner. This time, we will try to solve the issue of the dark castle and trees to the right of the photo, and put some color back into the scene. Before proceeding, we will make a copy of the Krita file, to save the current state for future reference or as a means of recuperation if disaster strikes. In our new copy, we will take the opportunity to combine all three layers present (the original image, a normal color layer and an overlay), to work on a single item going forward. Simply do a right-click on the topmost layer, and choose “Flatten Image”.

Dans l'épisode précédent, nous avons légèrement rogné cette image pour supprimer des dégâts sur les bords bas et gauche, utilisé l'aérographe pour réparer les dommages vers le bord du haut et quelques points noirs typiques qui étaient assez visibles dans le clel clair et, ensuite, superposé un calque avec une couleur noire et l'aérographe pour réduire l'effet d'une grand voile blanchâtre dans le coin en bas à gauche.

Cette fois-ci, nous essaierons de résoudre le problème de noirceur du château et des arbres à droite de la photo et de redonner quelques couleurs à la scène. Avant de procéder, nous ferons une copie du fichier Krita, pour sauvegarder l'état actuel comme référence future ou comme moyen de récupération si un désastre survient. Dans notre nouvelle copie, nous en profitons pour combiner les trois calques présents (l'image originale, une couche normale de couleurs et une superposition), pour poursuivre avec un seul calque. Faîtes simplement un clic droit sur le calque supérieur et choisissez « Flatten image » (Aplatir l'image ).

It is always instructive to take a quick histogram of our layer. With our only layer active, choose menu option “Layer”, then “Histogram”. In the resulting plot, we may need to change our channel. In my case, I needed to choose “GRAY/Alpha 32 float” since the original JPEG file was in grey-scale coded as 32-bits. The appropriate setting will be immediately apparent once the curve appears beneath. In this plot, the amount of pixels in each color is plotted, with frequencies of dark colors to the left, and light colors to the right. For our picture, we can observe a sharp peak to the right, which corresponds to the large amount of light-colored pixels in our sky, that cover around a third of the total image area. Towards the left of the histogram, the frequencies of darker pixels are more stretched out, denoting a scale of several dark colors that go from pure black at the extreme left, to a middle gray at the center of the plot.

C4est toujours instructif de prendre un rapide histogramme de notre calque. Notre unique calque étant actif, choisissez l'option « Layer » (Calque) du menu, puis « Histogram ». Dans le tracé résultant, nous devons changer notre canal. Dans mon cas, j'ai besoin de choisir « GRAY/Alpha 32 float » (Gris/Alpha 32 flottant) car le fichier original JPG est en échelle de gris codé en 32-bit. Le réglage approprié sera immédiatement apparent une fois que la courbe apparaît en dessous.

Dans ce graphe, la quantité de pixels pour chaque couleur est tracée, avec les fréquences des couleurs sombres à gauche et des couleurs claires à droite. Pour notre image, nous pouvons observer un pic aigu à droite, ce qui correspond à la grande quantité de pixels lumineux de notre ciel, qui couvre un tiers de la surface totale de l'image. Sur la gauche de l’histogramme, la fréquence des pixels noirs est plus étalée, dénotant une variété de couleurs noires différentes qui vont du pur noir à l’extrême gauche à un gris moyen au centre du tracé.

In other words, the darker part of our image –the landscape itself– is quite well-balanced, with pixels of many shades of gray. However, sky colors are very far apart from the earth, with a clear separation of a region of lighter colors in which there are not very many details. This results in a high level of contrast. For a more pleasing result to the eye, an ideal situation would be that in which the histogram plot would be as flat as possible, with a wide range of color values giving a richness of details. Moving forward, we have one basic choice to make. Do we leave the sky as it is, in sharp contrast to the ground, or do we try to compress sky colors into a narrower band, thus freeing up some color space that we can use to spread out earth colors somewhat. In our case, our sky is already quite washed out with little detail left in our original photo, so I feel that by compressing it further into even fewer colors we are actually losing very little detail.

En d'autres termes, la part de noir dans notre image - le paysage lui-même - est bien équilibrée, avec des pixels de nombreuses variations de gris. Cependant, les couleurs du ciel sont bien séparées du sol, avec une séparation claire d'une région aux couleurs plus claires dans laquelle il n'y a pas beaucoup de détails. Un fort contraste en est le résultat. Pour un résultat plus agréable à lœil, une situation idéale serait celle dans laquelle le tracé de l'histogramme soit aussi plat que possible, avec une large étendue de valeurs de couleurs amenant une richesse de détails.

Pour continuer, nous avons un choix de base à faire. Laissons-nous le ciel tel qu'il est, avec un contraste prononcé par rapport au sol, ou est-ce que nous essayons de compresser es couleurs du ciel dans une bande plus étroite, libérant ainsi un peu d'espace de couleurs que nous pourrions utiliser pour étendre quelque peu les couleurs du terrain. Dans notre cas, notre ciel est pratiquement lessivé avec un peu de détail sur la gauche de notre photo originale. ; aussi, je pense qu'en le compressant un peu plus sur un peu moins de couleurs, nous n'aurons perdu que peu de détails.

To alter the color balance of a layer in Krita, go the menu option “Filter”, then “Adjust”, then choose –for instance– “Color adjustment curves”. As can be seen in this submenu, the curves are not the only option available, and each user may want to give other tools a quick glance. In the curves’ dialog, the diagram in the middle represents the transformation we will apply to colors. The horizontal scale represents current colors, and the vertical the colors into which they will be transformed.

Pour modifier l'équilibre des couleurs d'un calque dans Krita, allez à l'option de menu « Filter » (Filtrer), puis choisissez, par exemple, « Color adjustment curves » (Courbes d'ajustement des couleurs). Comme vous pouvez le voir dans ce sous-menu, les courbes ne sont pas l'unique option disponible et chaque utilisateur peut vouloir donner un coup d'œil aux autres outils.

Dans le dialogue des courbes, Le diagramme du milieu représente la transformation que nous appliquerons aux couleurs. L'échelle horizontale représente les couleurs actuelles et la verticale, les couleurs dans lesquelles elles seront transformées.

The curve itself is initially a diagonal line. This means that, at first, each current color will be transformed into itself — i.e., it will be left as it is. Now, by simply moving the curve (and so introducing control points represented by dots), we will tell the application which alterations to perform. Moving the curve upwards will make the affected range of colors lighter, and moving it downwards will darken them. In our case, the general intent was to lighten the earth, so I raised the curve lightly. It is best to avoid wide, sweeping movements: regions where the curve approached being either completely vertical or completely horizontal tend to give rather strange results that shock the eye. Please note, also, that I have retained a second control point low in the left corner: this is here to ensure that pixels that are completely black remain so.

La courbe est-même est initialement une diagonale. Ça signifie que, d'abord, chaque couleur actuelle sera transformée par elle-même - par ex. elle sera laissée telle qu'elle. Maintenant, en déplaçant simplement la courbe (et, ce faisant, en introduisant des points de contrôle, représentés par des points), nous indiquerons à l'application les modifications à réaliser. Un déplacement de la courbe vers le haut éclaircira la zone des couleurs concernées, et un déplacement vers le bas les assombrira. Dans notre cas, le souhait général est d'éclaircir le sol ; aussi, j'élève légèrement la courbe. C'est bien d'éviter les grands balayages ; les zones dont la courbe s'approche qui sont, soit complètement verticales, soit complètement horizontales, ont tendance à donner des résultats étranges qui agreese l'œil. Notez aussi, s'il vous plaît, que j'ai retenu un second point de contrôle en bas dans le coin gauche : ici, c'est pour assurer que les pixels qui sont complétement noirs le restent.

Our resulting picture, so far is: If we consult our new histogram, we can see that the main image has colors spread out over a wide range, while the sky is still bunched up in a single sharp peak to the right. This last bit does not represent a major alteration over the original state, while the main body of the image is more balanced than previously.

Au point où nous en sommes, notre image résultante :

So far, our photo has progressed quite a bit in quality in comparison to the original. However, one aspect is lacking to give the scene a tad more realism: colors. These were lost during the initial photography, when the black-and-white negative was exposed. In a broad sense, the chemicals spread over the glass plate were sensitive only to the general light intensity falling on them. Information was lost concerning the exact wavelengths. In more recent color photographic film, several layers of sensitive chemicals inter-spaced with filters allow retaining information on separate colors on, at least, three different wavelengths. Thus, a (rather good) approximation of the scene’s original colors may be recomposed after processing, making positive copies and development. In our case, however, this color is completely lost to us. In digital terms, what we now see as a level of gray coded 200 on a range of 0 (black) to 255 (white) shows up as a light gray. It is possible that the original color in the scene was a light gray, with red, green and blue values of 200, 200 and 200 and with average intensity 200. But the original color could very well have been 250, 200 and 150, a light salmon color due to the presence of more red and less blue. It could also have been 150, 200 and 250, a light pastel blue, or any other variation of primary colors giving the same average intensity of 200.

Our takeaway here, is that in order to colorize our image, we will need to add back the information that has been lost. Luckily, our experience as humans tells us that the sky should probably be blue, and the trees green. To finish up for today, let us add in Krita a new transparent layer. We will also need to convert the image from gray-scale to color. To do so, choose menu option “Image”, and “Convert image color space”. Set it to “RGB/Alpha”, i.e. three color channels (red, green and blue), plus an alpha (transparency) channel.

Now, with the airbrush at a low opacity setting (about 0.2 should give good results), and rather broad opening (perhaps in the range of 40 to 300 pixels, depending on overall image size), let us brush in some color. Unlike in the first part of this series, when we were covering up small defects, now we will need to proceed with wide open strokes giving coverage to large areas at once, but with little density. For our first attempt, we will be using just three colors –a light blue, a darker green, and a reddish brick pink– and not worrying about complete coverage of each part of the scene.

The result, so far, is quite reminiscent of period hand-coloring of black and white photographs in the early 1900s. We already get a better appreciation of how the city’s rooftops and white buildings must have stood out from the surrounding vegetation and blue sky. However, we can also see that this approach has some drawbacks. The main one is that, since we are simply adding color on top of an existing black motive, we are darkening considerably the scene as a whole. This is not very realistic. Another problem is that our green coverage, for example, is uniform across different types of trees and grass, each of which would have had its very own shade and intensity. So, we need to think about how to modulate our new colors as a function of what they are laid out upon. This is what we shall do in the next episode of our series, though the reader is encouraged to experiment freely on his/her own beforehand. Until then, take care!

issue153/krita.1581405853.txt.gz · Dernière modification : 2020/02/11 08:24 de d52fr