Image size in mm

Post Reply
User avatar
magnussandstrom
Advanced member
Posts: 350
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Image size in mm

Post by magnussandstrom »

Hi, I'm building a flow where I need to present image size in millimetres (image files).

I tried:

Code: Select all

[Switch.Calculation:Expression="[Switch.Calculation:Expression="[Image.ImageWidth]/[Image.XResolution]"]*25.4"]x[And the same calculation for height]
But since Image.XResolution is 3000000/10000 and not 300 I doesn't get the intended result.

Any suggestions?
freddyp
Advanced member
Posts: 1017
Joined: Thu Feb 09, 2012 3:53 pm

Re: Image size in mm

Post by freddyp »

The fact that [Image.XResolution] is 3000000/10000 is not a problem because in a calculation that results in 300. However!

Suppose the value of [Image.ImageWidth] is 6000. Your calculation becomes 6000/3000000/10000. As there are no parentheses the 6000 is divided by 3000000 first, and the result of that is divided again by 10000. That is a very small image indeed :). Place parentheses around [Image.XResolution].
User avatar
magnussandstrom
Advanced member
Posts: 350
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: Image size in mm

Post by magnussandstrom »

Thanks you Freddy!

This works now:

Code: Select all

[Switch.Calculation:Expression="round([Switch.Calculation:Expression="[Image.ImageWidth]/([Image.XResolution])"]*25.4)"]x[Switch.Calculation:Expression="round([Switch.Calculation:Expression="[Image.ImageLength]/([Image.YResolution])"]*25.4)"]
Post Reply