images generated by slow method creates image of 8bit with 256 colors but, image generated by quick method creates image of 24bit though colors are 256, this might not be the required scenario all the time. if you convert the same image of 24bit in mspaint it will generate an image of 8bit and 256 colors.
nevertheless i appreciate what you have done.
Octree is a great algorithm that's fast and produces a well-optimized palette to best represent the original image. I use a C# implementation of it which can crunch a 1700x2200 pixel 32bit ARGB image down to 8-bit in 200 to 300 ms depending on complexity of the image.