Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6355429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:45:49+00:00 2026-05-24T22:45:49+00:00

I have a simple Applescript to resize photos with Image Events. The photos are

  • 0

I have a simple Applescript to resize photos with Image Events. The photos are all of football players so they are all named by their number as in “1.jpg”, “4.jpg” and so on. The issue I run into is when I do multiple batches of players in different directories the script will overwrite a photo with one from another team that has the same filename and was previously done. Again, these photos were all placed in different directories. The end result is after running successfully two or three times the reformatted photos of the players will get confused.

Here’s what I have in the script to call Image Events.

on open some_items
    repeat with this_item in some_items
        try
            rescale_and_save(this_item)
        end try
    end repeat
end open


to rescale_and_save(this_item)
    tell application "Image Events"
        launch
        set the target_width to 290
        -- open the image file
        set this_image to open this_item

        set typ to this_image's file type

        copy dimensions of this_image to {current_width, current_height}
        if current_width is greater than current_height then
            scale this_image to size target_width
        else
            -- figure out new height
            -- y2 = (y1 * x2) / x1
            set the new_height to (current_height * target_width) / current_width
            scale this_image to size new_height
        end if

        tell application "Finder" to set new_item to ¬
            (container of this_item as string) & "" & (name of this_item)
        save this_image in new_item as typ

    end tell
end rescale_and_save
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:45:50+00:00Added an answer on May 24, 2026 at 10:45 pm

    You seem to have triggered a bug in Image Events processing multiple items with the same name. I’m not seeing the exact behavior you describe, but I am seeing similar behavior.

    I’d suggest you simply tell Image Events to quit after processing each folder; that way it won’t get confused. (You don’t need the launch, either; the only reason to use launch is if you want a non-background application to open without presenting an untitled document window.)

    Incidentally, if you want to overwrite the existing image with the scaled version, all you need is save this_image. Image Events behaves much like any other application if you were to open a document, modify it, and save it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a very simple AppleScript to close tabs in Safari. The problem
I have a problem using a simple AppleScript on Mac OSX 10.7.3. With the
I have a simple 'repeat with' in an AppleScript, and would like to move
I have simple class with width and height member fields which define number of
I have simple registration form. Once all information entered, user click submit button and
So I have simple applescript that returns (return test) the following: NSAppleEventDescriptor: 'utxt'(test) I
I have a simple Ruby script that uses the rb-appscript gem to control iTunes,
I have simple table in Sybase -- Creating table 'SimpleText' CREATE TABLE [dbo].[SimpleText] (
I have simple php validation form that is halfway working. If you leave the
I have simple JavaScript snippet: var obrazek = [{nazwa: "Sniadanie", wiek: 100, autor: "Alicja"},{nazwa:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.