If you extract the image using ImageExtract, it will show
you the coordinates of the image. This is how you could detect that
the image is displayed upside-down:
--> Image: 1
Width: 451
Height: 294
BPC: 8
Coords: x1=137.43509, y1=336.31201, x2=353.51819, y2=195.25781
--> Image: 2
Width: 440
Height: 342
BPC: 8
Coords: x1=137.3755, y1=483.56018, x2=348.53619, y2=647.90338
The first image is upside-down --- its y1 coordinate is
larger than its y2 coordinate. If you want to automatically flip such
images, you could detect for this case and post-process the output. For
example, using ImageMagick the command would be:
convert.exe upside_down_image.jpg -flip corrected_image.jpg