The shortest code to run a command is:

import os
os.system("some command string here")


However, the *proper* way to call an executable is via this module:
http://docs.python.org/2.6/library/subprocess.html



On Wed, Jan 22, 2014 at 10:36 AM, Ognjen Vukovic <ognj...@gmail.com> wrote:

> Nice,
>
> imagemagick might be a nice solution.
> Can it somehow be called with win32 or similar, i want to convert the
> files directly from softimage and then do a search and replace inside the
> scene.
>
> Alok, would runing photoshop be resource a bit heavy, i dont really know
> how the commands go for it and time is on a bit of a budget right now.
>
>
>
> On Wed, Jan 22, 2014 at 4:33 PM, Alok Gandhi <alok.gandhi2...@gmail.com>wrote:
>
>> Also you could use 
>> OpenInageIO<https://sites.google.com/site/openimageio/home>,
>> it has python bindings. Alternatively, you could use Photoshop Scripting
>> through python and export as you wish. If on windows, you can use pywin32
>> to access photoshop application as com object.
>>
>>
>> On Wed, Jan 22, 2014 at 10:23 AM, Alan Fregtman 
>> <alan.fregt...@gmail.com>wrote:
>>
>>> If you're on Windows the nconvert.exe tool from the XnView folks is
>>> quite awesome:
>>> http://www.xnview.com/en/nconvert/
>>> (Worth noting that even though it's freeware, for commercial use they'd
>>> like you to purchase a license.)
>>>
>>> Alternatively, there is ImageMagick: http://www.imagemagick.org/
>>> Its "convert" executable can do a lot as well. The command you need is
>>> probably this or similar:
>>>
>>> convert somefile.psd -depth 16 -compress lzw somefile.tif
>>>
>>>
>>>
>>> Cheers,
>>>
>>>    -- Alan
>>>
>>>
>>>
>>> On Wed, Jan 22, 2014 at 9:39 AM, Ognjen Vukovic <ognj...@gmail.com>wrote:
>>>
>>>> Thanks guys,  will give them a test out now. Another thing, does anyone
>>>> know if there is a good library with which i can convert psd to 16 bit tiff
>>>> with lzw compression ?... i tried PIL but had no luck with that, testing
>>>> pillow now but cant seem to get it to work...
>>>>
>>>>
>>>> On Wed, Jan 22, 2014 at 3:09 PM, gareth bell <garethb...@outlook.com>wrote:
>>>>
>>>>> Or this if you want a new line for each file:
>>>>>
>>>>>
>>>>> xsi = Application
>>>>>
>>>>> extension = ".psd"
>>>>> listOfFiles = []
>>>>>
>>>>> currentProject = xsi.ActiveProject
>>>>>
>>>>> for eachFile in xsi.ActiveProject2.ActiveScene.ExternalFiles:
>>>>>     if extension in eachFile.Name:
>>>>>         listOfFiles.append(eachFile.Name)
>>>>>         print eachFile
>>>>>
>>>>> for eachPSD in listOfFiles:
>>>>>     newFile = open(str(currentProject) + XSIUtils.Slash +
>>>>> "myListFile.txt", "a")
>>>>>     newFile.write(str(eachPSD) + "\n")
>>>>>     newFile.close()
>>>>>
>>>>>
>>>>> ------------------------------
>>>>> From: garethb...@outlook.com
>>>>> To: softimage@listproc.autodesk.com
>>>>> Subject: RE: list of external files
>>>>> Date: Wed, 22 Jan 2014 14:03:39 +0000
>>>>>
>>>>>
>>>>> would this work?
>>>>>
>>>>>
>>>>> xsi = Application
>>>>>
>>>>> extension = ".psd"
>>>>> listOfFiles = []
>>>>>
>>>>> currentProject = xsi.ActiveProject
>>>>>
>>>>> for eachFile in xsi.ActiveProject2.ActiveScene.ExternalFiles:
>>>>>     if extension in eachFile.Name:
>>>>>         listOfFiles.append(eachFile.Name)
>>>>>         print eachFile
>>>>>
>>>>>
>>>>> newFile = open(str(currentProject) + XSIUtils.Slash +
>>>>> "myListFile.txt", "w")
>>>>> newFile.write(str(listOfFiles))
>>>>> newFile.close()
>>>>>
>>>>> ------------------------------
>>>>> From: ognj...@gmail.com
>>>>> Date: Wed, 22 Jan 2014 14:19:48 +0100
>>>>> Subject: list of external files
>>>>> To: softimage@listproc.autodesk.com
>>>>>
>>>>> Hi guys, is it possible to pull a list of external files from a scene
>>>>> that contain only the extension .psd for instance and write it somewhere 
>>>>> to
>>>>> disk.
>>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>>
>
>

Reply via email to