Export image histogram to text file