• 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: How do we Convert PICT to JPEG
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do we Convert PICT to JPEG


  • Subject: Re: How do we Convert PICT to JPEG
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 17 Aug 2015 23:52:03 +1000

On 17 Aug 2015, at 10:30 pm, Shane Stanley <email@hidden> wrote:

Pict required QuickDraw and Carbon, which means it can only going to be supported by 32-bit apps that use the Carbon APIs.

But it appears that if you ask nicely, the OS launches a 32-bit daemon (pictd) in the background to do the work. So if you're running Mavericks or later, this will do the job:

use scripting additions
use framework "Foundation"
use framework "AppKit"

on convertPICTFileAt:posixPath
-- build new path
set oldPath to current application's NSString's stringWithString:posixPath
set newPath to oldPath's stringByDeletingPathExtension()'s stringByAppendingPathExtension:"jpg"
-- make NSImage from file
set theImage to current application's NSImage's alloc()'s initWithContentsOfFile:oldPath
-- get TIFF version as data
set theData to theImage's TIFFRepresentation()
-- make bitmap representation from TIFF data
set bitmapImageRep to current application's NSBitmapImageRep's imageRepWithData:theData
-- extract jpeg representation from bitmap
set theData to bitmapImageRep's representationUsingType:(current application's NSJPEGFileType) |properties|:{NSImageCompressionFactor:1.0} -- between 0.0 and 1.0
--save to file
theData's writeToFile:newPath atomically:true
end convertPICTFileAt:

You'll need to save it to a script library under Mavericks.

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

 _______________________________________________
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: How do we Convert PICT to JPEG
      • From: Mark Hunte <email@hidden>
    • Re: How do we Convert PICT to JPEG
      • From: Yvan KOENIG <email@hidden>
References: 
 >How do we Convert PICT to JPEG (From: Malcolm Fitzgerald <email@hidden>)
 >Re: How do we Convert PICT to JPEG (From: Iurista GmbH <email@hidden>)
 >Re: How do we Convert PICT to JPEG (From: Mark Hunte <email@hidden>)
 >Re: How do we Convert PICT to JPEG (From: Shane Stanley <email@hidden>)

  • Prev by Date: issues with a find
  • Next by Date: Re: issues with a find
  • Previous by thread: Re: How do we Convert PICT to JPEG
  • Next by thread: Re: How do we Convert PICT to JPEG
  • Index(es):
    • Date
    • Thread