• 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
image resize with overwrite date creation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

image resize with overwrite date creation


  • Subject: image resize with overwrite date creation
  • From: MobileMe <email@hidden>
  • Date: Sat, 04 Sep 2010 17:46:22 +0200

Hi all,
I'am looking for a script that resize and keep the creation date like the original for numeric photo.
I write some code that work with only ONE PHOTO ! but doesn't if I drag more than one photo.
Please tell me what's wrong !!!
thank's
Ben
here is my code:
on open some_items
set the target_length to 640
display dialog "Enter the target length " & ¬
"and choose the dimension of the " & ¬
"image to scale to the target length:" default answer ¬
target_length buttons {"Cancel", "Height", "Width"}
copy the result as list to {target_length, target_dimension}
set the target_length to the target_length as number


repeat with this_item in some_items


tell application "Image Events"
launch
set theInfo to info for this_item
set newDate to the modification date of theInfo as date
-- open the image file
set this_image to open this_item
set typ to file type of this_image
copy dimensions of this_image to {W, H}
if the target_dimension is "Height" then
if W is less than H then
set the scale_length to the target_length
else
set the scale_length to (W * target_length) / H
set the scale_length to ¬
round scale_length rounding as taught in school
end if
else -- target dimension is Width
if W is less than H then
set the scale_length to (H * target_length) / W
set the scale_length to ¬
round scale_length rounding as taught in school
else
set the scale_length to the target_length
end if
end if


scale this_image to size target_length


save this_image
close this_image
tell application "Finder" to set the modification date of this_item to newDate
end tell
end repeat
end open

 _______________________________________________
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

  • Prev by Date: Re: Library Modules and Library Loaders
  • Next by Date: Re: File path of a file
  • Previous by thread: Re: File path of a file
  • Next by thread: Re: Sorting a list of records
  • Index(es):
    • Date
    • Thread