I use this code to automatically create scaled images and thumbnails for my website:
on open draggedItems
repeat with currentFile in draggedItems
tell application "System Events"
set home_directory to (path to current user folder) as string
end tell
set image_path to (home_directory & "Sites:barridoff:2005:images:")
set thumbnail_path to (home_directory & "Sites:barridoff:2005:thumbnails:")
try
tell application "Image Events"
launch
set openedFile to open (currentFile as alias)
set properties of openedFile to {bit depth:millions of colors, color space:RGB, resolution:{72.0, 72.0}}
scale openedFile to size 750
save openedFile as JPEG in image_path with icon
scale openedFile to size 125
save openedFile as JPEG in thumbnail_path with icon
close openedFile
end tell
on error error_message
display dialog error_message
end try
end repeat
end open
It works perfectly, except that for some images, a one-pixel wide/high black line appears along one of the edges of the images, usually the top. It appears (though I’m not certain) that this odd black line replaces the top line of my image, which is worse (if it just added the line, I’d figure out a way to automatically crop it out; this way, I’m rather stuck).
I can’t for the life of me figure out what’s causing this or how to fix it.
Any indeas?