Skip to main content
Inspiring
March 28, 2018
Answered

Resizing image with vector layers while keeping transparency.

  • March 28, 2018
  • 3 replies
  • 692 views

Hello. I have a script that saves a large image in multiple resolutions to PNG. The image has several layers, some of them are vector-based. Before resizing, I call

app.activeDocument.flatten();

Otherwise, the vectors will not scale (interestingly, this happens only when resizing via script, not manually). However flattening the image removes transparency. Do you have any suggestions on how to deal with this? I'm thinking using script to rasterize all the vector layers before resizing, but perhaps I'm missing a better solution?

This topic has been closed for replies.
Correct answer Chuck Uebele

How about using merge visible instead?

var idMrgV = charIDToTypeID( "MrgV" );

executeAction( idMrgV, undefined, DialogModes.NO );

3 replies

Tom Winkelmann
Inspiring
March 28, 2018
JJMack
Community Expert
Community Expert
March 28, 2018

Flatten merges all layer into a background layer. Photoshop's background is a special bottom layer that is canvas size that does not support transparency.  It transparency is locked all pixels are 100% opaque.

JJMack
Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
March 28, 2018

How about using merge visible instead?

var idMrgV = charIDToTypeID( "MrgV" );

executeAction( idMrgV, undefined, DialogModes.NO );

Inspiring
March 28, 2018

Thank you Chuck. Works great!