image scaling

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?ISO-8859-15?Q?Michael_H=FCbner?=

    image scaling

    Hi guys,

    I need to scale an image before inserting it into a database. But I
    really have no idea - everything on the net that I have found so far is
    dealing with files that are physically stored in a folder. Does anyone
    of you have any sample code or links for me?

    Thanks in advance,

    Michi
  • =?Utf-8?B?TWljaGFlbCBOZW10c2V2?=

    #2
    RE: image scaling

    You are in the right direction :)
    You can use the samples you found. Everything you need is consider working
    with your images from memory stream, not from the file stream like in folders.

    Smth like this
    byte[] b = (byte[])cmd.ExecuteSca lar();

    // Open a stream for the image and write the bytes into it
    MemoryStream stream = new System.IO.Memor yStream(b, true);
    stream.Write(b, 0, b.Length);

    // Create a bitmap from the stream
    Bitmap bmp = new Bitmap(stream);

    --
    WBR, Michael Nemtsev [.NET/C# MVP].
    Blog: http://spaces.live.com/laflour



    "Michael Hübner" wrote:
    Hi guys,
    >
    I need to scale an image before inserting it into a database. But I
    really have no idea - everything on the net that I have found so far is
    dealing with files that are physically stored in a folder. Does anyone
    of you have any sample code or links for me?
    >
    Thanks in advance,
    >
    Michi
    >

    Comment

    • =?Utf-8?B?QnJhdWxpbyBEaWV6?=

      #3
      RE: image scaling

      You have to play with streams, about how to scale (easy algorithm) and
      playing with the image in memory:










      About how to save images on SQL Server:



      HTH
      Braulio

      /// ------------------------------
      /// Braulio Diez
      ///
      /// http://www.tipsdotnet.com
      /// ------------------------------




      "Michael Hübner" wrote:
      Hi guys,
      >
      I need to scale an image before inserting it into a database. But I
      really have no idea - everything on the net that I have found so far is
      dealing with files that are physically stored in a folder. Does anyone
      of you have any sample code or links for me?
      >
      Thanks in advance,
      >
      Michi
      >

      Comment

      Working...