Jump to content
Macro Express Forums

Determine resolution of a JPG image?


terrypin

Recommended Posts

Is there a clever way that ME can capture the width and height of an image please?

 

I use IrfanView for cropping, and in the appropriate dialog I need to enter the height in pixels of the original image. ME can 'Set value from current window height', but apparently not from the resolution data. I could do it by the rather fiddly method of opening the Properties of the file in IrfanView and capturing the information there, but I'm wondering if there is a smarter way I've missed please?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

I use IrfanView for cropping, and in the appropriate dialog I need to enter the height in pixels of the original image. ME can 'Set value from current window height', but apparently not from the resolution data. I could do it by the rather fiddly method of opening the Properties of the file in IrfanView and capturing the information there, but I'm wondering if there is a smarter way I've missed please?

 

Hello Terry,

 

When using third-party macro development tools like Macro Express, we are sometimes limited in our ability to capture programmatic "under the hood" information. Instead, we are forced to do somersaults and backflips with the UIs of the applications we are scripting for.

 

If you can script a macro that quickly and reliably records data by opening a Properties dialogue, navigating to the fields that contain the data, capturing the information, closing the Properties window, and returning focus to where it was when you started, you have accomplished something!

 

It is fiddly, but this is the only way to perform certain tasks if one's primary tool is Macro Express.

Link to comment
Share on other sites

Thanks Alan.

 

Out of curiosity, shortly after posting, I did exactly that. It turned out to be less fiddly than I'd expected and allowed me to quickly crop about 200 photos last night.

 

In case any other IrfanView user here has a similar requirement, I've copied my hastily-written code below. Out of habit, I've included generous delays, which may well be redundant, but it's fast enough anyway.

 

<REM2:Crop 3:2 to 4:3 from top left in IrfanView><REM2:Start with image open in IrfanView><REM2:Get depth of original image window; this will be preserved by macro><REM2:Open Properties><TEXTTYPE:i><MSD:100><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB><TAB><TAB>><MSD:100><TEXTTYPE:<CONTROL>c><MSD:100><TEXTTYPE:<ENTER>><MSD:100><TVAR2:01:03:><REM2:Get the height into T2><TMVAR2:10:02:01:008:004:><REM2:Convert T2 to integer N2><TMVAR2:05:02:02:000:000:><REM2:Open the crop window, which must already be set to 4:3><TEXTTYPE:<SHIFT>c><MSD:100><TEXTTYPE:<TAB><TAB><TAB><TAB><TAB><TAB>><MSD:100><TEXTTYPE:%N2%><MSD:100><TEXTTYPE:<ENTER>><MSD:100><TEXTTYPE:<CONTROL>y><MSD:100><TEXTTYPE:<CONTROL>s><MSD:200><TEXTTYPE:y><MSD:100><MRETURN>

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...