Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > BinaryImage > GridBinaryImage creates huge bmp files

Not answered GridBinaryImage creates huge bmp files

Feed from this thread
  • Chanan Zass Intermediate avatar

    Posted on Mar 14, 2011 (permalink)

    Greetings,

    We're using GridBinaryImageColum to upload jpg images whose size is about 100KB.
    These images are saved in a varbinary columns in a database.
    When calling these images on the front-end, we get bmp images that exceed 1.1MB.

    It that normal?
    Is there a way to avoid the size jump, or is it simply better not to use the BinaryImage for such scenarios?

    Thanks in advance.

     

    Reply

  • Daniel Daniel admin's avatar

    Posted on Mar 17, 2011 (permalink)

    Hello Chanan,

    What do you mean by "calling these images on the front-end"? Do you use the GridBinaryImageColumn to display the images? If so, could you please help us to reproduce the problem on our end by providing additional information or sample project?
    Please note that we do not convert the images in our code.

    Best regards,
    Daniel
    the Telerik team

    Reply

  • Chanan Zass Intermediate avatar

    Posted on Mar 17, 2011 (permalink)

    Sorry for not updating this post earlier, as we've resolved this issue a bit later.

    We use RadGrid with GridBinaryImageColumn to upload JPG images (back-end).
    We show these images (front-end) using a repeater and RadBinaryImage.

    Displaying these as they are fed directly from the database results in huge BMP images.
    Problem was resolved by processing the images before displaying them:
    <telerik:RadBinaryImage ID="bimgArt" Height="301px" Width="931"
    DataValue='<%# FormatImage(Eval("ArtImage")) %>' ResizeMode="None"
    AlternateText='<%# Eval("ArtTitle") %>' ToolTip='<%# Eval("ArtTitle") %>' runat="server" />

    And in the codeBehind (VB.NET):
    Public Function FormatImage(ByVal img As Byte()) As Byte()
            Dim stream As New MemoryStream(img)
            Dim streamOut As New MemoryStream
      
            Dim myImage As Image = Image.FromStream(stream)
            myImage.Save(streamOut, ImageFormat.Jpeg)
            Return streamOut.ToArray()     
        End Function

    This displays as a JPG image (with reduced weight).

    Reply

  • Daniel Daniel admin's avatar

    Posted on Mar 22, 2011 (permalink)

    Hello Chanan,

    Thank you for sharing your code with our community.
    Under normal circumstances you won't have to use such approach as we don't make any conversions to the image.

    Regards,
    Daniel
    the Telerik team

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > BinaryImage > GridBinaryImage creates huge bmp files