Let \( g \) be the number of girls in the class and \( b \) be the number of boys in the class.
According to the problem, the number of girls who retake their school pictures is given by:
\[ \frac{1}{4} g \]
It is stated that the photographer retakes pictures for 16 girls, so we can write the equation:
\[ \frac{1}{4} g = 16 \]
To find \( g \), we multiply both sides by 4:
\[ g = 16 \times 4 = 64 \]
Next, we consider the boys. The number of boys who retake their pictures is given by:
\[ \frac{1}{8} b \]
It is stated that the photographer retakes pictures for 7 boys, leading to the equation:
\[ \frac{1}{8} b = 7 \]
To solve for \( b \), we multiply both sides by 8:
\[ b = 7 \times 8 = 56 \]
Now, we can find the total number of students in the class by adding the number of girls and boys:
\[ g + b = 64 + 56 = 120 \]
Thus, the total number of students in the class is
\[ \boxed{120} \]