The LED flash on the Samsung Galaxy S4 is a lot more powerful than the one used in the Sony Xperia Z and this is main reason for the disappointing indoor performance of Xperia Z when compared to the Galaxy S4.
And here come the 100% crops where you can clearly see the Galaxy S4 superiority.
Finally, the cloudy weather was no sweat for the Samsung Galaxy S4 - more than enough detail, good colors and contrast, while the Sony Xperia Z got the exposure wrong and produced a noisy sample with an only average amount of fine detail.
Check the crops to see for yourself.
The HDR samples from both phones are good, but the Galaxy S4 HDR stills are probably the best we've seen from a smartphone. The Samsung flagship takes a while to process the image but it has subtle yet good results. It mostly brings out detail in the highlights and gives shadows a slight boost without producing extra noise or ruining contrast. The Xperia Z is faster, also brings out detail in the highlights, but it does nothing for the shadows and noticeably lowers the contrast of the whole picture.
Finally, we come to comparing the panorama shots from the two smartphones.
Keep in mind that the Galaxy S4 must be used in portrait mode to be able to shoot a full-res 360-degree panorama, otherwise you'll get a lower-res, poorly stitched picture. We are not quite sure what the reason behind this is and it might have something to do with the software still being finalized.
Anyway, the Samsung Galaxy S4 is capable of shooting a full-res 360-degree panorama, which results in photos of about 60MP resolution (roughly 20000x3000px). The picture quality is amazing and stitching is very good. Because the Xperia Z can't do 360-degree panos, we only covered the same viewing angle with the two.
The Sony Xperia Z also offers very-well stitched panorama samples with good contrast, but that's the only good we can say. The detail could have been better, the resolution is very low at about 5000x1080px, and the whole thing looks more like a video screenshot (which it probably is given the resolution) rather than a shot worthy of a flagship.
We put the Samsung Galaxy S4 and the Sony Xperia Z in our Photo Compare Tool. Both did excellently on all the charts, though once we come to a more real-life scenario (third poster), the noise reduction of Xperia Z takes its toll and the smartphone comes short of the Galaxy S4.
Winner: Samsung Galaxy S4. The Samsung flagship has a clear advantage in terms of image quality over its competitor.