I was able to solve this problem by concatenating two images.
Image principal = Image.FromFile(@"ImagemPrincipal.jpg");
Image logo = Image.FromFile(@"ImagemHeader.jpg");
int imagemSaida_Width = principal.Width;
int imagemSaida_Height = principal.Height + logo.Height;
var imagemSaida = new Bitmap(imagemSaida_Width, imagemSaida_Height);
using (principal)
{
using (imagemSaida)
{
using (var canvas = Graphics.FromImage(imagemSaida))
{
canvas.InterpolationMode = InterpolationMode.HighQualityBicubic;
// Definir plano de funda do arquivo de saida como Branco
canvas.Clear(Color.White);
// Adicionar o logo no arquivo de saida
canvas.DrawImage(logo, 0, 0);
// Adidionar principal no arquivo de saida
canvas.DrawImage(exame, 0, logo.Height);
canvas.Save();
}
imagemSaida.Save("ImagePrincipalComLogo.jpg");
}
}
See if this can help you http://stackoverflow.com/a/14593261/2221388
– Pablo Tondolo de Vargas
WinForms
orWPF
?– Ismael
I’m doing a windows service, this method I’ll put in a library.
– Fellipe
@Pablovargas This example the border overlays the image, I want to add a border.
– Fellipe
@Fellipe Do you want to insert this border "inside" the image? That is, edit the bmp file itself?
– Ismael
@Ismael was an option, but I decided to create another file by concatenating two images. I left a default border to be added in the images.
– Fellipe