Skip to content

Digitally_framing_paintings

John Cupitt edited this page Mar 29, 2017 · 1 revision

title: Digitally framing paintings permalink: /Digitally_framing_paintings/

Origin

This page has been written as part of the NIP2 Beginners Guide.

Introduction

Selecting new or alternative frames for paintings can be a difficult and time consuming process. Photographs of frames can be carefully re-sized, using a photocopier, or full size replica frame-sections can be made to compare with the painting. In order to simplify the initial stages of this process a digital solution was developed to allow quick controllable comparisons between images of paintings and frames. The software allows prepared images of rectangular frames or frame corners to be automatically re-sized to fit around a digital image of a retangular painting. The thickness of the generated frames and the depth of the rebate can be easily adjusted and a mount, of a user defined colour, can also be applied. This chapter will described the process of using the digital framing nip2 functions beginning with the preparation of the images before going onto described the digital framing functions themselves.

Image Preparation

In order for the images of frames and paintings to be correctly processed by the nip2 framing functions they need to be prepared. Once a frame image has been prepared it can be stored and used again against any other painting, normally without any additional preparation.

Preparing Frame Images


[Image:nipbeginguide040.png](/Image:nipbeginguide040.png "wikilink")
Figure 9.1: An example of some of the major steps in the preparaion of the image of a frame corner: **A:** A crop of the chosen frame corner, **B:** The correctly rotated frame corner, **C:** A crop of just the frame corner, **D:** The frame corner after the central section has been coloured in black.
fg:frame_prep

Some of the basic steps of the preparation process for frame images can be seen in figure [#fg:frame_prep 9.1]fg:frame_prep.

  • Load the image into a new column, for example, as object A1.
  • Crop the image to remove the excess areas around the frame or frame section, see section [#sec:crop 5.9.3]sec:crop, which will produce object A2. See figure [#fg:frame_prep 9.1]fg:frame_prep image A.
  • Use the rotation functions, see section [#sec:rotate 5.9.1]sec:rotate, to correct the orientation of the frame, which will produce object A3. Normally rotate it so that the bottom edge is straight for full frames, or that is positioned to be the top left hand corner for frame corners. See figure [#fg:frame_prep 9.1]fg:frame_prep image B.
  • Crop the image again to remove the excess areas around the frame or frame section, see section [#sec:crop 5.9.3]sec:crop, which will produce object A4. At this stage do not worry if the frame is not quite straight just crop off as much of the image you can without lossing any part of the frame. See figure [#fg:frame_prep 9.1]fg:frame_prep image C.
  • In the column command line[#note86\ 1] type in: A5 + 1 and hit [Return][#note87\ 2], which will produce object A6.
  • Adding 1 to the image changes the image number format, change it back to 8-bit using: [Main Window][Toolkits: Image: Number Format: 8-bit unsigned], which will produce A7.
  • Open up image A7 in an image viewer and use the painting tools, see section [#sec:paint 5.13]sec:paint, to colour the internal area of the frame black. See figure [#fg:frame_prep 9.1]fg:frame_prep image D.

Preparing Painting Images

  • Load the image into a new column, for example as object B1.
  • Use the rotation functions, see section [#sec:rotate 5.9.1]sec:rotate, to correct the orientation of the painting, which will produce object B2, normally rotate it so that the bottom edge is straight.
  • Crop the image to remove the excess areas around the painting, see section [#sec:crop 5.9.3]sec:crop, which will produce object B3. Do not worry if the painting is not quite straight, most are not, just crop off as much of the image you can without lossing any part of the painting.

Perspective Distortion Correction


[Image:nipbeginguide041.png](/Image:nipbeginguide041.png "wikilink")
Figure 9.2: An example of a frame before and after perspective distortion correction and the `nip2` column that performed the operation.
fg:frame_straighten

The perspective distortion correction function can be used to straighten up a frame. Real frames may not be quite straight, or the image may have been taken at a slight angle. Either way the frame needs to be straightened to ensure a better result from the framing functions.

  • Select the image of the prepared frame and then use the function: [Main Window][Toolkits: Tasks: Picture Frame: Straighten Frame], see figure [#fg:frame_straighten 9.2]fg:frame_straighten.
  • This function places four marks[#note88\ 3] on the selected image and then distorts the image so that the positions indicated by the marks are now in the corners.
  • Open your original image and then position the four marks[#note89\ 4] so that they are over the four corners of the frame. As the marks are repositioned the image of the corrected frame will be updated to reflect the changes.

If this process does not produce a satisfactory image it may be necessary to get a better original image of the frame.

Setting Relative Resolution

sec:rel_res In order to correctly compare a frame with a painting they both need to be the same relative resolution. The relative resolution is a measurement of how many pixels, in the image, represent a fixed distance on the original object. If all of you frame images are resized to the same relative resolution then they can easily be re-used in comparison with other paintings in the future. The exact relative resolution value does not really matter though the larger the number the more space the images will take up on your computer. Relative resolutions of 10, 15 or 20 pixels per cm have provided good results. The scale value required to correct the size of you image can be calculated as follows:

  • scale value = ((relative resolution) * (object width in cm))/(image width in pixels)
  • Therefore if your image is 2500 pixels wide, the original object is 45 cm wide and you want to create a 20 pixels per original cm image the scale value would be: (20 * 45)/2500 = 0.32.
  • Your image can then be resized using the function: [Main Window][Toolkits: Image: Transform: Resize: Scale] and change the two scale factors to equal your calculated scale value, in this case 0.32.

Saving the Prepared Images

Once all of the images preparation has been completed the images can be saved on to your computer, see section [#sec:save 5.4]sec:save. It is recommended that you save all frames as png files as they provide a good degree of compression without blurring the edges of the central section you have coloured black.

Applying the Framing Function


[Image:nipbeginguide042.png](/Image:nipbeginguide042.png "wikilink")
Figure 9.3: An example of a digital frame created from a frame corner and a sample image.
fg:frame_build_01


[Image:nipbeginguide043.png](/Image:nipbeginguide043.png "wikilink")
Figure 9.4: This image shows an example of the size and position of the default sections that are cropped from the an original frame to produce the new version of the frame.
fg:frame_build_02


[Image:nipbeginguide044.png](/Image:nipbeginguide044.png "wikilink")
Figure 9.5: An example of two different views of the complex object created when using the digital frame building functions in `nip2`.
fg:frame_build_03

There are three different functions for building digital frames included in nip2.

  • Select the frame image then the painting images and then run the appropriate function, see figure [#fg:frame_build_01 9.3]fg:frame_build_01.
  • [Main Window][Toolkits: Tasks: Picture Frame: Build Frame: Frame Corner]
  • The Frame Corner function will try to construct a complete rectangular frame from a image of the top left hand corner of a frame.
  • [Main Window][Toolkits: Tasks: Picture Frame: Build Frame: Simple Frame]
  • The Simple Frame function will try to construct a complete rectangular frame from the image of an existing rectagular frame, this allows the separate edges of the frame to appear different from each other.
  • [Main Window][Toolkits: Tasks: Picture Frame: Build Frame: Complex Frame]
  • The Complex Frame function works in a similar way to the Simple Frame function, however it allows for the retention of a central section in the middle of each of the edges.
  • Each of the functions crop small sections of the original frame image and automatically reassemble them to create a new frame, see figure [#fg:frame_build_02 9.4]fg:frame_build_02.

Customising the Automatically Generated Frames.

When run each of the frame building functions will produce a new complex object similar to object C3 in figure [#fg:frame_build_03 9.5]fg:frame_build_03. By default this object contains two variables, ppcm and overlap that a user can adjust to alter the appearance of the frame. The variables and mount options objects can be opened up to display further variables and options, see object E1 in figure [#fg:frame_build_03 9.5]fg:frame_build_03. The different functions contain different options but a complete list of the available options with explanations is given below.

  • ppcm: This value should be changed to represent the actual relative resolution thats was used to create the original images, in pixels per cm, see section [#sec:rel_res 9.2.4]sec:rel_res.
  • overlap: This defines the size of the frame rebate in cm, this value is applied based on the relative resolution set in ppcm. Negative values for overlap, see object E1 in figure [#fg:frame_build_03 9.5]fg:frame_build_03, result in a mount being applied around the painting.
  • variables:
    • scale_factor: This variable controls the thickness of the frame section. The default value is 1, a value of 2 would make the frame twice as thick and a value of 0.5 would make the frame half as thick.
    • corner_section: This option defines the size of the section used to define the corners.
    • edge_section: Only for the complex frame function, this option defines the size of the section used to create the edges of the frame.
    • middle_section: This option defines the size of the section general used to create the edges of the frame. However in the complex function this option defines the size of central section that needs to be retained.
    • blend_fraction: The frames are constructed by cropping small sections of the frame, duplicating them and them blending them together. This variable controls the fraction of the overlap between each of the little pieces.
    • option: By default this option tells the function to just to use the left hand sections to make the left half of the frame and then produce a mirror version of it for the right hand side. If deselected the function will use all of the sections to create the complete frame. This option is not avaliable in the corner frame functions.
  • mount options:
    • apply: This option tells the function if it needs to apply the other mount options.
    • ls: This option allows the user to increase the size of the lower section relative to the others. The value needs to be given in cm relative to the original size of the painting.
    • mount_colour: This option allows the user to define the colour of the mount. DLMB on the colour to open up a separate window which will allow you to select a colour, see figure [#fg:paintcolour 5.12]fg:paintcolour.
  • frame: This separate image of the frame can be saved separately if required.

[1] [2] [3] [4]

References

[1] see section [#sec:col_command 5.2.2]sec:col_command.

[2] This process is going to use black or zero value pixels to define areas in the image, adding 1 to your images ensure that there are no original zero pixels in the image.

[3] see section [#sec:regions 5.8]sec:regions

[4] see section [#sec:regions 5.8]sec:regions.

Clone this wiki locally