私は、ファイルからの画像を重ねてペイントするPictureBoxを持っています(慣れている場合は、フォトショップのレイヤーの概念のように)。PNGであり、不透明度インデックスを備えているため、これらの画像は画像合成の最適な候補です。しかし、それを実行してファイルに保存する方法がわかりません。
次のコードサンプルでは、2つのPNG画像をビットマップオブジェクトにロードし、PictureBoxにペイントしました。
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Rectangle DesRec = new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height);
Bitmap bmp;
Rectangle SrcRec;
bmp = (Bitmap)Image.FromFile(Application.StartupPath + "\\Res\\base.png");
SrcRec = new Rectangle(0, 0, bmp.Width, bmp.Height);
e.Graphics.DrawImage(bmp, DesRec, SrcRec, GraphicsUnit.Pixel);
bmp = (Bitmap)Image.FromFile(Application.StartupPath + "\\Res\\layer1.png");
SrcRec = new Rectangle(0, 0, bmp.Width, bmp.Height);
e.Graphics.DrawImage(bmp, DesRec, SrcRec, GraphicsUnit.Pixel);
}
コンポジションをファイル、できれば別のPNGファイルに保存するにはどうすればよいですか?