Hello guys!
I'm having such a trouble with editing a image.
This is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace Removedor_de_Banners
{
public partial class Form1 : Form
{
string caminho = null;
int largura = 0;
int altura = 0;
public Form1()
{
InitializeComponent();
}
private void btnImg_Click(object sender, EventArgs e)
{
if (abrirImg.ShowDialog() == DialogResult.OK)
{
caminho = abrirImg.FileName;
boxCaminho.Text = caminho;
Image tamanho = Image.FromFile(caminho);
lblAltura.Text = "Altura: " + tamanho.Height.ToString() + "px";
lblLargura.Text = "Largura: " + tamanho.Width.ToString() + "px";
altura = tamanho.Height;
largura = tamanho.Width;
}
}
public Bitmap CropBitmap(Bitmap bitmap, int cropX, int cropY, int cropWidth, int cropHeight)
{
Rectangle rect = new Rectangle(cropX, cropY, cropWidth, cropHeight);
Bitmap cropped = bitmap.Clone(rect, bitmap.PixelFormat);
return cropped;
}
}
}
The problem is... I don't know how to save the returned bitmap! The code isn't completed at all, but I want to make the save function first. Can you guys give me some help?
Thanks!