Rotate image reducing file size

hi,
I'm on Dopus 12.3

Rotating a jpg file using
Image ROTATE=90 HERE REPLACE
@nodeselect
also with the
Image ROTATE=90 HERE REPLACE PRESERVEDATE
@nodeselect

cause the file to reduce substantially in size:
in the example below, from 6.1MB to 5.48MB




This is a very big difference -- anyone know what's actually happening there?
TIA, Tom

Related thread:
lossless rotation of image

There it is suggested to convert to Bitmap and compare.
I did this: the resulting files are exactly the same size to the byte, but they look very different compared using WinMerge-
(I'm no expert in comparing files - normally only use that for text/csv files).

Visually, I cant see any difference between the two bitmap files -- so hopefully compression of the files is ruled out.

I dont know does Dopus do a simple file comparision, but when I put the files in different folders, and do a byte comparision, it does try to copy one to the other, i.e. does not see them as same.


IMO even loseless rotation may change filezise because of changing informations inside file (but not image data). You can, for example, write JPG from IrfanView with erase any additional informations, then using other program to rotate image (Opus for example) and this program adds info about rotation to the file (and sometimes other informations too).

You can also compare few random pixels of image using Photoshop or other program like that and read color information from the same places on two different images. Try to read few pixels next to each other (JPEG compression changes that) from the same location on both images.

By default, Opus will do a lossless rotation if it can, but not all JPEGs can be rotated losslessly. (The image width and height need to be multiples of the block size, essentially.)

If lossless is not possible, the image data has to be unpacked, rotated, then recompressed, which will change the file size and may reduce image quality.

Even lossless JPEG rotation can change the file size slightly, as peterb says.