public static Bitmap DecompressHuffman(string imgSrc)
        {
            //moram da pocnem odmah otvaranjem fajla i ucitavanjem bajtova redom kako su upisivani
            byte[]      bmpWidth;
            byte[]      bmpHeight;
            byte[]      stride;
            byte[]      downsampleChannels;
            byte[]      dictionarySize;
            byte[]      dictionary;
            byte[]      YDataLen;
            byte[]      CbDataLen;
            byte[]      CrDataLen;
            byte[]      imageData;
            HuffmanTree tree = new HuffmanTree();

            using (var reader = new BinaryReader(File.Open(imgSrc, FileMode.Open)))
            {
                bmpWidth           = reader.ReadBytes(4);
                bmpHeight          = reader.ReadBytes(4);
                stride             = reader.ReadBytes(4);
                downsampleChannels = reader.ReadBytes(4);

                YDataLen  = reader.ReadBytes(4);
                CbDataLen = reader.ReadBytes(4);
                CrDataLen = reader.ReadBytes(4);

                dictionarySize = reader.ReadBytes(4);

                int dictSize = BitConverter.ToInt32(dictionarySize, 0);

                dictionary = reader.ReadBytes(dictSize);
                tree.DeserializeDictionary(dictionary);

                List <byte> compressedData = new List <byte>();
                while (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    compressedData.Add(reader.ReadByte());
                }

                imageData = tree.Decode(new BitArray(compressedData.ToArray()));
            }

            int width                = BitConverter.ToInt32(bmpWidth, 0);
            int height               = BitConverter.ToInt32(bmpHeight, 0);
            int strideInt            = BitConverter.ToInt32(stride, 0);
            int downampleChannelsInt = BitConverter.ToInt32(downsampleChannels, 0);
            int yDataLen             = BitConverter.ToInt32(YDataLen, 0);
            int cbDataLen            = BitConverter.ToInt32(CbDataLen, 0);
            int crDataLen            = BitConverter.ToInt32(CrDataLen, 0);


            DownsampleFormat format = new DownsampleFormat(strideInt, width, height, yDataLen, cbDataLen, crDataLen, downampleChannelsInt);

            format.data = imageData;
            Downsampling sampling = new Downsampling();

            return(sampling.RestoreBitmap(format));
        }