Follow the code below:
public FileContentResult Foto_Pequeno()
{
byte[] byte_image = null;
string query = "SELECT * FROM Imagem WHERE Id = '1'";
using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
using (var command = new SqlCommand(query, connection))
{
connection.Open();
using (var reader = command.ExecuteReader())
{
if (reader.Read())
{
byte_image = (byte[])reader["Image"];
}
}
}
return new FileContentResult(byte_image, "image/png");
}
In the database is written as varbinary (MAX), the image size is as 946x456. How do I resize the image if it is larger than 100x100. Like height and width.
Is it possible to resize image byte array to 100 x 100?