• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trying to get image dimensions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trying to get image dimensions


  • Subject: Re: Trying to get image dimensions
  • From: Shane Stanley via AppleScript-Users <email@hidden>
  • Date: Wed, 3 Jun 2020 12:05:34 +1000

On 3 Jun 2020, at 11:19 am, Jenni via AppleScript-Users
<email@hidden> wrote:
>
>> I take that as a pretty good hint to look for a different approach.
>
>       I found sips for the command line, but that returns 3 lines of
> information that I’d need to parse, so I was hoping for an easier solution.

I meant my comment in terms of avoiding the use of aliases, however it's
probably worth mentioning that using sips -- or AppleScriptObjC -- means one
fewer application authorization dialogs when you edit and run the script.

The ASObjC version would be:

use AppleScript version "2.5" -- macOS 10.11 or later
use framework "Foundation"
use scripting additions

set k to "Macintosh SSD:Users:shane:Desktop:Fjords.tiff"
set imagePosixPath to POSIX path of k
set theImageRep to current application's NSBitmapImageRep's
imageRepWithContentsOfFile:imagePosixPath
set fileHeight to theImageRep's pixelsHigh()
set fileWidth to theImageRep's pixelsWide()

--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Trying to get image dimensions
      • From: Jenni via AppleScript-Users <email@hidden>
References: 
 >Trying to get image dimensions (From: Jenni via AppleScript-Users <email@hidden>)
 >Re: Trying to get image dimensions (From: Shane Stanley via AppleScript-Users <email@hidden>)
 >Re: Trying to get image dimensions (From: Jenni via AppleScript-Users <email@hidden>)
 >Re: Trying to get image dimensions (From: Deivy Petrescu via AppleScript-Users <email@hidden>)
 >Re: Trying to get image dimensions (From: Jenni via AppleScript-Users <email@hidden>)

  • Prev by Date: Re: Trying to get image dimensions
  • Next by Date: Re: Trying to get image dimensions
  • Previous by thread: Re: Trying to get image dimensions
  • Next by thread: Re: Trying to get image dimensions
  • Index(es):
    • Date
    • Thread