![]() |
| ||
| [saving animated GIF] Help... if I want to send an animated GIF format picture, how do I save the picture in destination folder? I already using "System.Drawing.Imaging.ImageFormat.gif", but the GIF picture no longer animated, it become like JPEG format. another help please... |
| ||
| Re: [saving animated GIF] Help... Could you please post your current image saving code. Thanks! |
| ||
| Re: [saving animated GIF] Help... Never mind the code. Here's a (generic) function to save byte array to a file (VB.NET 2005 and newer) Public Function SaveFile(ByVal FileName As String, ByRef Buffer() As Byte, ByVal OverWrite As Boolean) As BooleanAnd you call it (example): If SaveFile("C:\my.gif", ByteBuffer, False) ThenAnother example: SaveFile("C:\my.gif", ByteBuffer, True) saves the file and overwrites the file if it exists.One thing to be careful is array indexing which starts from the zero. If you declare an array Buffer(4) As Byte, you'll have an array with five bytes (Buffer(0), Buffer(1),...Buffer(4)). Forgetting this can easily lead to "off-by-one" errors and hard-to-catch errors. HTH Use this code to save animated GIF. It might be possible that "normal" .NET's image saving methods (or file formats to be precise) do not support animated GIFs. Saving an animated GIF as "raw" data is 100% sure way to ensure it is saved correctly. |
| ||
| Re: [saving animated GIF] Help... thanks for the code... I'll try it first... |
| ||
| Re: [saving animated GIF] Help... Dim PACKET_SIZE As UInt16 = 4096 it's my code went socket receive picture n save it. still cannot save animated GIF picture. the code are working perfectly, but the saved picture can't move... I'm not changing anything for the function... |
| ||
| Re: [saving animated GIF] Help... Actually you're saving incoming data to the memory stream, not in the temporary byte buffer. You should save the content of the memory stream. Change this single line If SaveFile("C:\my.gif", MStream.ToArray(), False) ThenToArray method returns the content of the whole memory stream as a byte array.And one reminder again. Close and dispose streams, sockets etc. after using them :) If the code still doesn't work after making the code change above, could you please attach your original animated gif image. Not sure if I have in hand any easily findable animated gif to test with :-/ |
| ||
| Re: [saving animated GIF] Help... Your code working GREAT !! Finally I found what's wrong... my mistake is I save the selected GIF picture to JPG format before displaying it... by doing that, I send and save the JPG format instead of the GIF file... that's why my GIF never move... sorry to trouble U. |
| ||
| Re: [saving animated GIF] Help... Quote:
Quote:
|
| All times are GMT -4. The time now is 3:01 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC