I have an issue where some images in the reporting module are oriented incorrectly.
I have an image upload component that saves images to SQL and a report that will retrieve these images. The preview in Windows and well as my perspective component show all images in one orientation but the reporting module flips them. I don't know much about how JPEG's handle rotation but I am guessing there is some metadata within the photo that dictates what orientation the image is. Can I make the reporting module respect the orientation that Windows and the perspective image component is showing?
update:
(Or can I at least have the perspective image component show what the orientation will be in the reporting module so the user can rotate before he submits the images?)
Image Preview in windows for upload

Images preview in Perspective component. These pull from BLOB in SQL via WebDev
The generated report from the reporting module

I attached the exact images I am using.
Images.zip (103.3 KB)
I've just come across the same issue with the reporting module, did you ever manage to find a solution to this?
I tested it across a number of devices and images, in my case it looked like pictures taken on Samsung devices (have not yet had the chance to test on Apple devices) specifically have metadata that the reporting module can't interpret.
The Hypo look very happy.
1 Like
I came across this issue today too and saw that there wasn't an answer here, so I'll post my solution that works. My setup is that I have the photo data stored as blobs in a SQL table. I have a display table on a screen with a list of photos, which are displayed when a user selects a row. The code below will execute in a separate button to flip the image vertical or horizontal. I hope this helps someone in the future!
from javax.imageio import ImageIO
from java.io import ByteArrayInputStream
from java.awt.image import BufferedImage
from java.awt.geom import AffineTransform
from java.awt.image import AffineTransformOp
from java.io import ByteArrayOutputStream
photoDS=event.source.parent.getComponent('yourphototablehere').data #Table with list of photos stored in a SQL database
rw=event.source.parent.getComponent('yourphototablehere').selectedRow
ID=photoDS.getValueAt(rw,"rowguid") #primary key from the SQL table
sql="SELECT yourPhotoDataColName FROM yourPhotoDataTable WHERE rowguid=?" #get the data from your SQL table
photoData=system.db.runPrepQuery(sql,[ID],'yourserverconnectionname')
bytes=photoData[0][0] #image bytes to work with
mode="vertical" #set transform mode
bais = ByteArrayInputStream(bytes)
image = ImageIO.read(bais)
bais.close()
#horizontal flip--- comment out as needed
tx = AffineTransform.getScaleInstance(-1, 1);
tx.translate(-image.getWidth(None), 0);
op = AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
imageH = op.filter(image, None);
#For vertical flip--- comment out as needed
ty = AffineTransform.getScaleInstance(1, -1);
ty.translate(0, -image.getHeight(None))
op = AffineTransformOp(ty, AffineTransformOp.TYPE_NEAREST_NEIGHBOR)
imageV = op.filter(image,None)
#Select which transform to use
if mode=="vertical":
image=imageV
else:
image=imageH
baos = ByteArrayOutputStream()
ImageIO.write(image, "jpg", baos)
flippedBlobData = baos.toByteArray() #--the flipped data to work with----
baos.close()
#To display the new image in an image component
tempName=system.file.getTempFile("photo2.png")
system.file.writeFile(tempName,flippedBlobData)
tempName2="file:///"+tempName
event.source.parent.getComponent('Image').path=tempName2 #set an image component to the newly created file
sql="UPDATE yourPhotoDataTable SET yourPhotoDataColName=? WHERE rowguid=?" #write back to SQL and update the data
system.db.runPrepUpdate(sql,[flippedBlobData,ID],'yourserverconnectionname')
system.db.refresh(event.source.parent.getComponent('yourphototablehere'), "data") #update the display table
2 Likes