![]() |
|
|||||
|
Drawing the Image | |||||
We create a Bitmap from the core file we are interested in. Because we want the aspect ratio to be maintained we calculate what it is, and then scale the image size down by that factor. Note that we can apply a scalar multiple directly to the Size structure, and then add it to another Size. [C#]
|
||||||
|
Drawing a Frame | |||||
We then create a new Bitmap that size and draw our source image into it. We include a filled black rectangle in the background so we get a black border around the image. You can use draw operations for rectangles but a fill is guaranteed to be inside the rectangle. [C#]
|
||||||
|
Drawing the Text | |||||
We want to draw a caption vertically up the side of the output image. So we need to use MeasureString to find out how much space it is going to take up. Once we have established that then we can enlarge the bitmap that much on the right hand side. To draw the text vertically we need to apply a rotation transform followed by a translation to move it into the correct position. [C#]
|
||||||
|
Saving | |||||
Finally we save the picture as a high quality JPEG image. [C#]
|
||||||
|
Input and Output | |||||
Sample input and output images are shown below.
|