CreateRenditions for children in the Masked Group

Hi there,

Moved question below.

CreateRenditions for MaskedGroup’s children.
As for the output of the mask image, I want the following image.
mask

However, the output is a transparent image.
I need your help.

Can someone please help me?

Sorry; I don’t understand the question?

Hello, Kerri.
Created a sample.

A mask-group consists of four colored boxes and a mask image of a circle.

Following plugin to output the image.
Outputs an image of the children of the selected group.

async function pluginRenditionChildren(selection, root) {
  const outputFolder = await fs.getFolder()

  if (!outputFolder) return console.log('User canceled folder picker.')

  let renditionOptions = []
  const length = selection.items[0].children.length
  for (let i = 0; i < length; i++) {
    const item = selection.items[0].children.at(i)
    const fileName = item.name + '.png'
    const file = await outputFolder.createFile(fileName, {
      overwrite: true,
    })
    renditionOptions.push({
      fileName: fileName,
      node: item,
      outputFile: file,
      type: application.RenditionType.PNG,
      scale: 1,
    })
    console.log(fileName)
  }

  const results = await application
    .createRenditions(renditionOptions)
    .catch(error => {
      console.log('exception:' + error)
      // https://forums.adobexdplatform.com/t/details-for-io-failed/1185/14
      // https://helpx.adobe.com/xd/kb/import-export-issues.html
      console.log(
        '1)access denied (disk permission)\n2)readonly folder\n3)not enough disk space\n4)maximum path\n5)image size 0px',
      )
    })
  console.log('done.')
}

The output image is as follows.

For the mask image, I would expect something like the following.
キャプチャ.PNG

Being able to output a mask image makes it possible to apply it to other applications.

Please consider it.
Thank you.

@peterflynn – I’m not as familiar with the ins-and-outs of XD’s export when it comes to masks – any thoughts here?

Even now, I cannot get a masked image.
There must be some policy in AdobeXD.

However, may want to get it for use in other applications.
I was able to get the mask image as follows.

  if (renditionNode.parent && renditionNode.parent.mask === renditionNode) {
    selection.items = [renditionNode.parent]
    commands.duplicate()
    const duplicatedMaskNode = selection.items[0].mask
    commands.ungroup()
    //...rendition
  }