python - what is wrong with my script, export psd to bmp? -


i trying export psd file bmp.

if del zhe line ###here, generator test.png correctly, want bmp file,

if use ###here , "attributeerror: property 'photoshop.bmpsaveoptions.format' can not set."

import win32com.client import os  fn='test.psd' psapp = win32com.client.dispatch('photoshop.application') options = win32com.client.dispatch('photoshop.exportoptionssaveforweb') options.format = 13         # png options.png8 = false        # sets png-24 bit #options = win32com.client.dispatch('photoshop.bmpsaveoptions') ###here del #options.format = 2         # bmp # fd=os.path.abspath('.') fk=os.path.join(fd, fn) doc = psapp.open(fk) fn='bbb' fn = os.path.splitext(fk)[0] + '_' + fn + '.png' #fn = os.path.splitext(fk)[0] + '_' + fn + '.bmp'  ### doc.export(exportin=fn, exportas=2,  options=options) #exportas=2, doc.close(2) 

if reading question (apoligies if not) want save file in bmp , not png format. guess need change options.format

options.format = 13 # png

after research looks bmp 2 i'd change code to:

options.format = 2 # bmp

as note, i'd recommend change filename when save file avoid confusion. maybe this?

fn = os.path.splitext(fk)[0] + '_' + fn + '.bmp'


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -