implemented densitiestoRGB