Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

132
Visualizações
Photoshop Javascript - Resize multiple layers

I have a script on Photoshop that allows me to resize a layer to the image bounds while maintaining the proportions.
The code is the seguent:

    var Document = app.activeDocument;
    var BND = app.activeDocument.activeLayer.bounds;
    var IHeight = (BND[3] - BND[1]);
    var IWidth = (BND[2] - BND[0]);
    if (IWidth >= IHeight) {
        Document.activeLayer.resize ((Document.width / IWidth * 100), (Document.width / IWidth * 100), AnchorPosition.MIDDLECENTER);
        }
    else {
        Document.activeLayer.resize ((Document.height / IHeight * 100), (Document.height / IHeight * 100), AnchorPosition.MIDDLECENTER);
        }

The problem is that it only resizes the active layer.
I'm trying to integrate the seguent piece of code that selects all the layers:

    var NAD = new ActionDescriptor ();
    var NAR = new ActionReference ();
    NAR.putEnumerated (charIDToTypeID ("Lyr "), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));
    NAD.putReference (charIDToTypeID ("null"), NAR);
    executeAction (stringIDToTypeID ("selectAllLayers"), NAD, DialogModes.NO);

What I want to do is resize all the layers together so that they can keep the same aspect ratio between each other, so i can't resize with a loop or the proportions would be lost by transforming all layers to the same size as the canvas.
Do you have any ideas how this could be done?
I have already tried to replace activeLayer with layers or artLayers, but I get "Error 1302: No such element" and I don't know how to address the problem.

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda