Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda