Implementing EyalAr/lwip#87 : Detect image type from buffer