【问题标题】:Overriding image width with updateExportSettings使用 updateExportSettings 覆盖图像宽度
【发布时间】:2014-04-08 06:57:16
【问题描述】:

我有cross posted on the Adobe Forums

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

ExportFilterProvider400.lua:

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:

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 中测试。

【问题讨论】:

    标签: plugins lua lightroom


    【解决方案1】:

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

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

    经过反复试验,我有了这个最小的例子, Info.lua(无变化):

    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

    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,
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-08
      相关资源
      最近更新 更多