rb-appscript를 사용하여 PSD를 PNG로 내보내는 스크립트를 작성했습니다. 멋지다. 멋쟁이지만, 나는 애호가로 풀어 낼 수 없다.py-appscript를 사용하여 PSD를 PNG로 내보내려면 어떻게해야합니까?
다음은 루비 코드입니다 :
#!/usr/bin/env ruby
require 'rubygems'
require 'optparse'
require 'appscript'
ps = Appscript.app('Adobe Photoshop CS5.app')
finder = Appscript.app("Finder.app")
path = "/Users/nbaker/Desktop/"
ps.activate
ps.open(MacTypes::Alias.path("#{path}guy.psd"))
layerSets = ps.current_document.layer_sets.get
# iterate through all layers and hide them
ps.current_document.layers.get.each do |layer|
layer.visible.set false
end
layerSets.each do |layerSet|
layerSet.visible.set false
end
# iterate through all layerSets, make them visible, and create a PNG for them
layerSets.each do |layerSet|
name = layerSet.name.get
layerSet.visible.set true
ps.current_document.get.export(:in => "#{path}#{name}.png", :as => :save_for_web,
:with_options => {:web_format => :PNG, :png_eight => false})
layerSet.visible.set false
end
그리고 여기에 분명히 비등가 파이썬 코드입니다 :
from appscript import *
from mactypes import *
# fire up photoshop
ps = app("Adobe Photoshop CS5.app")
ps.activate()
# open the file for editing
path = "/Users/nbaker/Desktop/"
f = Alias(path + "guy.psd")
ps.open(f)
layerSets = ps.current_document.layer_sets()
# iterate through all layers and hide them
for layer in ps.current_document.layers():
layer.visible.set(False)
#... and layerSets
for layerSet in layerSets:
layerSet.visible.set(False)
# iterate through all layerSets, make them visible, and create a PNG for them
for layerSet in layerSets:
name = layerSet.name()
layerSet.Visible = True
ps.current_document.get().export(in_=Alias(path + name + ".png"), as_=k.save_for_web,
with_options={"web_format":k.PNG, "png_eight":False})
작동하지 않습니다 파이썬 스크립트의 유일한 부분은 절약입니다. 다른 내보내기 옵션과 내용을 시도하는 데 여러 가지 오류가 발생했습니다.
연결이 잘못되었습니다 ... 일반 Photoshop 오류가 발생했습니다. 이 기능은이 버전의 포토샵에서 사용할 수 없습니다 ... 일부 데이터를 예상되는 유형으로 만들 수 없습니다 ...
저는 루비 스크립트만으로도 살 수 있지만 다른 모든 스크립트는 파이썬으로되어 있습니다. 그래서 파이썬에서 이것을 풀 수있는 것이 좋을 것입니다. 인터넷에 미리 감사드립니다. 나중에 몇 개월이라도 -