Acabo de ver tu mensaje , justo ayer habia encontrado una funcion que tambien vale , la pongo por si a alguien no le funciona la que has puesto tu Ivan
Código:
const int Lx = 173;
// Ancho maximo para las miniaturas
const int Ly = 234;
float l2;
float newHeight, newWidth;
// Alturam axima para las miniaturas
if (((myBitmap.Width / Lx) > (myBitmap.Width / Ly)))
{
l2 = myBitmap.Width;
newWidth = Lx;
newHeight = (myBitmap.Height * (Lx / l2));
if ((newHeight > Ly))
{
newWidth = (newWidth * (Ly / newHeight));
newHeight = Ly;
}
}
else
{
l2 = myBitmap.Height;
newHeight = Ly;
newWidth = (myBitmap.Width
* (Ly / l2));
if ((newWidth > Lx))
{
newHeight = (newHeight * (Lx / newWidth));
newWidth = Lx;
}
}
La comento 1 poco : Comprueba si es una imagen mas alta o ancha antes de redimensionar y luego redimensiona en la misma proporcion y en funcion al tamaño maximo que le hemos indicado.
Ahora estoy trabajando en hacerle un crop, solo me falta la libreria, cuando este listo lo subo