首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用updateExportSettings覆盖图像宽度

使用updateExportSettings覆盖图像宽度
EN

Stack Overflow用户
提问于 2014-04-08 14:57:17
回答 1查看 136关注 0票数 0

我有cross posted on the Adobe Forums

在写我的第一个lightroom插件时,我创建了一个minimal example,它应该设置照片宽度here,并包含在下面。但是,我无法获得指定的400x400的图像。

ExportFilterProvider400.lua:

代码语言:javascript
复制
local LrView = import 'LrView'
local bind   = LrView.bind
--------------------------------------------------------------------------------
-- This function will create the section displayed on the export dialog 
-- when this filter is added to the export session.

local function sectionForFilterInDialog( f, propertyTable )
  return {
    title = LOC "$$$/SDK/MetaExportFilter/SectionTitle=400x400 Filter",
  }
end

--------------------------------------------------------------------------------
-- Example on updating export settings
local function updateExportSettings( exportSettings ) 
  exportSettings.LR_size_maxHeight = 400
  exportSettings.LR_size_maxWidth  = 400
  exportSettings.LR_size_doConstrain = true
end

--------------------------------------------------------------------------------
return {
sectionForFilterInDialog = sectionForFilterInDialog,
updateExportSettings     = updateExportSettings    , --Does this work
}

Info.lua:

代码语言:javascript
复制
return {
  LrSdkVersion        = 3.0,
  LrSdkMinimumVersion = 1.3, 
  LrPluginName        = "400x400 Export",
  LrToolkitIdentifier = 'sample.export400x400',

  LrExportFilterProvider = {
    title = LOC "$$$/SDK/MetaExportFilter/Sample=400x400 Size", -- the string that appears in the export filter section of the export dialog in LR
    file  = 'ExportFilterProvider400.lua', -- name of the file containing the filter definition script
    id    = "metadata1",  -- unique identifier for export filter
  },

  VERSION = { major=5, minor=0, revision=0, build=907681, },
}

Adobe Lightroom可以加载插件,并将其添加到导出会话中,但updateExportSettings似乎不起作用。在Lightroom 5.3中测试。

EN

回答 1

Stack Overflow用户

发布于 2014-04-09 05:53:20

Rob Cole在Adobe SDK论坛上指出,updateExportSettings被“导出服务提供商”用来预设导出设置。

“导出筛选器提供程序”应将renditionOptions作为postProcessRenderedPhotos的一部分使用。

经过反复试验,我得到了这个最小的例子,Info.lua (不变):

代码语言:javascript
复制
return {
  LrSdkVersion        = 3.0,
  LrSdkMinimumVersion = 1.3, -- minimum SDK version required by this plugin
  LrPluginName        = "400x400 Export",
  LrToolkitIdentifier = 'sample.export400x400',

  LrExportFilterProvider = {
    title = LOC "$$$/SDK/MetaExportFilter/Sample=400x400 Size", 
    file  = 'ExportFilterProvider400.lua', 
    id    = "metadata1",  -- unique identifier for export filter
  },
  VERSION = { major=5, minor=0, revision=0, build=907681, },
}

ExportFilterProvider400.lua

代码语言:javascript
复制
local LrView = import 'LrView'
local bind   = LrView.bind

local function sectionForFilterInDialog( f, propertyTable )
  logger:info('Called sectionForFilterInDialog')
  return {
    title = LOC "$$$/SDK/MetaExportFilter/SectionTitle=400x400 Filter",
  }
end  

local function postProcessRenderedPhotos( functionContext, filterContext )  
  local renditionOptions = {
    filterSettings = function( renditionToSatisfy, exportSettings ) 
      exportSettings.LR_size_maxHeight = 400
      exportSettings.LR_size_maxWidth  = 400
      exportSettings.LR_size_doConstrain = true
    end
  }

  for sourceRendition, renditionToSatisfy in filterContext:renditions( renditionOptions ) do
    -- Wait for the upstream task to finish its work on this photo. 
    local success, pathOrMessage = sourceRendition:waitForRender()  
  end  
end
--------------------------------------------------------------------------------

return {
  sectionForFilterInDialog  = sectionForFilterInDialog,
  postProcessRenderedPhotos = postProcessRenderedPhotos,
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22929765

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档