views:

127

answers:

1

I have a need to select a portion of a .png file, with specific cordinators, and delete this area then save the file back with the same name. I would appreciate if you can help to come up with a VBScript script that can accomplish this task. It would be great if all proesses happen in the background, but it would be ok too if the image file has to be open and visible. Thanks a bunch!!!

A: 

VBScript doesn't have any image editing functions, so you need an external tool for that. For example, GIMP can do image processing from the command line (see here). ImageMagick provides a scriptable component in addition to the command-line interface (details here).

To run a command line from a VBScript script, you can use the WShShell.Run method. To create an instance of a COM scriptable component, use the CreateObject function.

Helen
Well, you can read/write files with vbscript.So, if you know how to locate the pixel data within your .png files, you can modify it. To do so, you would basically make your own png file parser. Once you had such a parser, you would have to translate your two x,y coodinates into the locations of all those pixels in the file and change their values.png files are very complex, however. They can be flat or have layers, and they can have a transparency channel. The things I mention above aren't trivial. I think the answer above will get you what you want.
George Sisco