Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > image scaling

Reply
Thread Tools

image scaling

 
 
Michael Hübner
Guest
Posts: n/a
 
      11-18-2007
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
 
Reply With Quote
 
 
 
 
Michael Nemtsev
Guest
Posts: n/a
 
      11-18-2007
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.ExecuteScalar();

// Open a stream for the image and write the bytes into it
MemoryStream stream = new System.IO.MemoryStream(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
>

 
Reply With Quote
 
 
 
 
Braulio Diez
Guest
Posts: n/a
 
      11-19-2007
You have to play with streams, about how to scale (easy algorithm) and
playing with the image in memory:


http://www.thescripts.com/forum/thread225328.html

http://www.codeproject.com/csharp/imageresize.asp

http://www.dotnet247.com/247referenc...31/156505.aspx

http://www.informit.com/articles/art...?p=377078&rl=1

About how to save images on SQL Server:

http://www.codeproject.com/useritems..._SQL_Serve.asp

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
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
prevent image scaling for high dpi displays Yofnik ASP .Net 3 01-27-2007 05:50 PM
Specifying 100% image scaling pmennen HTML 11 01-16-2007 03:32 AM
Image Sizing/Scaling - Photshop CS BobS Digital Photography 3 12-28-2004 07:35 AM
Scaling PNG image ko021_626@hotmail.com Java 3 04-30-2004 01:37 PM
Overriding browser image auto-scaling Daniel L. Bateman HTML 6 10-30-2003 09:59 PM



Advertisments