-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
56 lines (49 loc) · 1.52 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.IO;
namespace EditGif
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Beggining:");
using (var gif = File.OpenRead("test.gif"))
{
var formatBuff = new byte[6];
var widthBuff = new byte[2];
var heightBuff = new byte[2];
var descriptorBuff = new byte[3];
var byteBuff = new byte[1];
var northWestBuff = new byte[4];
var width2Buff = new byte[2];
var height2Buff = new byte[2];
var LCTDescriptorBuff = new byte[1];
gif.Read(formatBuff);
gif.Read(widthBuff);
gif.Read(heightBuff);
gif.Read(descriptorBuff);
var bitsPerPixel = (0x0F & descriptorBuff[0]) + 1;
var GCTBuff = new byte[2 ^ (bitsPerPixel) * 3];
gif.Read(GCTBuff);
do
{
gif.Read(byteBuff);
} while (byteBuff[0] != 0x2C);
gif.Read(northWestBuff);
gif.Read(width2Buff);
gif.Read(height2Buff);
gif.Read(LCTDescriptorBuff);
var format = System.Text.Encoding.ASCII.GetString(formatBuff);
short width = BitConverter.ToInt16(widthBuff);
short height = BitConverter.ToInt16(heightBuff);
short width2 = BitConverter.ToInt16(width2Buff);
short height2 = BitConverter.ToInt16(height2Buff);
Console.WriteLine(format);
Console.WriteLine(width);
Console.WriteLine(height);
Console.WriteLine(width2);
Console.WriteLine(height2);
};
}
}
}