• 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: Converting images from one format to another
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting images from one format to another


  • Subject: Re: Converting images from one format to another
  • From: dev_sleidy <email@hidden>
  • Date: Tue, 1 Aug 2006 08:23:02 -0400

Hi List,

I am seeking ... image conversion.

I often convert images ... in Preview. Yes, I know, it is a very tedious job especially when there are many items to change. I have no doubt that this is a very good candidate for scripting.

Actually, 'Preview' itself is not scriptable); yet, it is - somewhat.
For example - view 'Mik P's 10.07.2006 ('applescript-users') post titled 'Attivating the display dialog window', and the seven (7) 'Re: Attivating the display dialog window' replies.


... what is the next ideal solution?

Either drag '.jpg' file(s) onto (saved) applet (of code below), or double click on applet and select folder containing '.jpg' files. No error checking provided.


Sample code :

on open tSelection
 my handle_Selection(tSelection)
end open

on run {}
tell application "Finder" to set tList to every file of folder ((choose folder with prompt "Select a folder of graphic files to process") as string)
my handle_Selection(tList)
end run


on handle_Selection(local_Selection)
tell application "Image Events"
launch
repeat with i in local_Selection
tell application "Finder" to set tExtension to (name extension of i)
set i_String to (i as string)
set fRef to open i_String
save fRef as PNG in (my handle_file_name(i_String, tExtension)) with icon
close fRef
end repeat
end tell
end handle_Selection


on handle_file_name(local_String, local_Extension)
if (local_Extension contains "jpg") then
set {oAStId, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "."}
set tString to text items 1 through -2 of local_String
set AppleScript's text item delimiters to oAStId
return ((tString as string) & ".png")
end if
return (local_String & ".png")
end handle_file_name
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Converting images from one format to another
      • From: Romy Opena <email@hidden>
  • Prev by Date: Re: Add prices with taxes in quark
  • Next by Date: Re: Converting images from one format to another
  • Previous by thread: Re: Add prices with taxes in quark
  • Next by thread: Re: Converting images from one format to another
  • Index(es):
    • Date
    • Thread