Manejo de imagenes "pesadas" en SQLServer c#

Renzo Rivera 21 Reputation points
2020-06-27T12:12:28.85+00:00

Actualmente guardo mis imágenes de la siguiente forma:
public byte[] ImagenToBytes(Image Imagen)
{
byte[] arreglo;
if (Imagen != null)
{
MemoryStream Bin = new MemoryStream();
Imagen.Save(Bin, ImageFormat.Png);
arreglo = Bin.GetBuffer();

        }
        else
        {
            return null;
        }

        return arreglo;
    }

El problema es que cuando muestro los registros que tienen las imágenes en un gridview se tarda mucho para cambiar de fila debido al peso de la imagen (4MB o menos) Lo que se me ocurre es comprimirla antes de guardarla pero no se como hacer esto o que tan factible sea esta solución para resolver mi problema.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
41,925 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2020-06-27T12:33:29.237+00:00

    C# is not currently supported here on QnA. Also QnA is currently English only forums. They're actively answering questions in dedicated forums here.
    https://social.msdn.microsoft.com/Forums/es-ES/home?forum=vcses

    or possibly over here.
    https://social.msdn.microsoft.com/Forums/sqlserver/es-ES/home?forum=sqlserveres

    --please don't forget to Accept as answer if the reply is helpful--


    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.