Question to RotateMWGRegionCW90 (rotate_regions.config)

Started by herb, October 14, 2022, 07:08:56 AM

Previous topic - Next topic

herb

Hello,

With Exiftool 12.47 I started playing with rotation of MWG-regions and have a question to the following statements e.g. in RotateMWGRegionCW90.
return {
   AppliedToDimensions => {
      W => $val[0]{AppliedToDimensions}{W},
      H => $val[0]{AppliedToDimensions}{H},
      Unit => $val[0]{AppliedToDimensions}{Unit},
 },
Is it really correct NOT to exchange height and width?

I think the values of AppliedToDimensions will be used to find absolute pixel-values from the normalized ones.
MWG standard says: Width and height of image at the time of processing when storing metadata
So I hope to be right.

Thanks for your help in advance and
Best regards
herb

StarGeek

Looking over the MWG guidelines, I'd say it depends.  If the image itself has been rotated, for example by jpegtran, and you're rotating the region to match, then yes.  But if the rotation is based upon a change in the EXIF:Orientation tag, then no.

   
QuoteA Creator or Changer MUST express region coordinates, width and height relative to the stored image, prior to the application of the Exif Orientation tag. In other words, the origin of the image is the upper left. This allows the region information to remain stable when Exif Orientation is taken into account.

I do question the value of these tags though.  I can't think of a use where you would use these values rather than the actual image width and height.  I was using Picasa when I wrote and it used the actual image dimensions rather than using these.

It's easy enough to add
"-RegionAppliedToDimensionsW<ImageWidth" "-RegionAppliedToDimensionsH<ImageHeight"
to any command to cover both ways.  It would have to be after copying the region as per note #4 under the -TagsFromFile option.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

herb

Hello StarGeek,

thanks for your comments and of course thanks for all these great Composite-Region tags.
Thanks also for pointing to tag EXIF:Orientation.

I read the MWG-standard again and came to the following:
- MWG region tags depend ONLY on physical layout of the pixel.
- EXIF:Orientation is not taken into account.

So this means: In case of a rotation done with changing EXIF:Orientation NO change on MWG-region tags has to be performed.
Only in case of rearranging pixel the composite tag RotateMWGRegionCWxxx comes into play.
In case of CW90 the mid-point of a region is set
my %newRgn = (
             Area => {
             X => 1-$rect[1],
             Y => $rect[0],
Because of this, also AppliedTo Dimensions should also be set properly - exchanging height and width.
W => $val[0]{AppliedToDimensions}{H},
H => $val[0]{AppliedToDimensions}{W}

I think,to use ImageHeight and ImageWidth for this is not the best idea:
Do really ALL file/image-formats (also RAW formats) have these tags?
All tags should be taken from region-structures only.

Best regards
herb

Phil Harvey

Hi Herb,

Quote from: herb on October 15, 2022, 03:53:58 AMI think,to use ImageHeight and ImageWidth for this is not the best idea:
Do really ALL file/image-formats (also RAW formats) have these tags?

I try my best to generate ImageWidth/ImageHeight for all formats.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).