I have a database designed and implemented using ms sql server 2005. initially, the user has entered the pictures with a very big size because there was not restriction. now when the user is opening the crystal report so it takes alot of time and some time memory full problem occur. now i want to reduce the stored images size using vb.net. is it possible? can you help me.. because there is nothing impossible as per my experence.
geoamins2
0
Light Poster
Recommended Answers
Jump to PostYes, it's possible.
First you need to identify which images to resize. You may have to iterate through the entire datatable opening each image and looking at the size.Once you determine that an image needs to be resized, then you could do something like this:
Jump to PostOk, Here you go.
Try Dim fs As New FileStream(Trim(txtPath.Text), FileMode.Open) Dim Data() As Byte = New [Byte](fs.Length) {} fs.Read(Data, 0, fs.Length) Dim NewImageAs Byte() NewImage= GetResizedImage(Data, 640, 480) sql = "UPDATE Biodata Set Pic=@img WHERE No='" & Trim(txtReg.Text) & "' " Dim cmd As New SqlCommand(sql) …
All 5 Replies
CodeWord
6
Junior Poster in Training
geoamins2
0
Light Poster
CodeWord
6
Junior Poster in Training
geoamins2
0
Light Poster
CodeWord
6
Junior Poster in Training
Swetha_8
commented:
Thank you for the code but after the size is decreased when view the saved image from database the picture is viewed as black any help.
+0
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.