Jump to content
  • Advertisement
Sign in to follow this  
musafir2007

Write code to automate computer actions

This topic is 3083 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok so my digital camera takes pictures that are of 5mb-6mb. I can open and save those images using photoshop and the result is 500-600kb. the difference is not noticeable on the computer screen which is what I want. (lower quality setting on camera does give lower size but the quality loss is noticeable)
So basically I have over 1000 pictures on my computer and would like to write a script/code or something that can open pictures, change quality setting using photoshop and save them.
I know there are softwares out there that can record computer actions and repeat them. but I would like program this on my own just to get some automation experience.
I do have some (intermediate) programming background in c++, java and c# but have never done anything like this before. Any ideas would be great!
thanks!

Share this post


Link to post
Share on other sites
Advertisement
I'm a big fan of not reinventing wheels, so my first reaction is to say that you should just get a batch image converter like Irfanview and use that.

Of course as you say writing your own is a very educational exercise, so if you think the experience would be valuable, by all means don't let me discourage you from giving it a shot [smile]

Share this post


Link to post
Share on other sites
Maybe photoshop has a command line stuff too? A very very long multi-argument command?
And use a batch file?

Share this post


Link to post
Share on other sites
I was also going to suggest just using existing methods, like Photoshop has a feature to save a set of actions and bind them to a shortcut key. Using this, your task of resizing, saving, etc should be a bit easier to handle.

However, you did mention you want to write this automation process using a program yourself, so I guess my suggestion isn't much help for you.

As for writing a program that saves user actions and repeating them with your program, probably involves a lot of digging deep into your operating system's API. I think writing your own image compression (resizing) tool might be a bit easier in terms of achieving your automation goal (such as what daveodonoghue has pointed you to).

Share this post


Link to post
Share on other sites
You could also try AutoIt. It allows you to manipulate Windows programs and has quite a few other features, like file IO and a simple UI system. I don't use it myself, but I work with some people who swear by it for Windows automation tasks.

Share this post


Link to post
Share on other sites
Photoshop exposes COM interfaces, so you could use javascript (or any other COM-aware language) to make an instance of it and code against it. You can use the same interfaces to communicate with it via .net too.

The Photoshop object model is extensively documented by Adobe, and basic tasks such as batch image resizing are not very difficult to code.

Share this post


Link to post
Share on other sites
Quote:
Original post by ChurchSkiz
I'm not a photoshop expert, but I have done something like this before. There's a batching command where you select a list of actions to do and it will do it for specific files. Google:

http://shapeshed.com/journal/batch_resizing_in_photoshop/


Yes - Photoshop has had macro functionality for a while.


As for size - long time ago, before it got bloated, ACDsee had the best JPEG compression of all, by doing some internal tweaks. It would regularly outperform Photoshop by 25-50% at same JPEG quality (quality as defined by spec). I'm not sure if this still holds.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!