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

107
Vistas
Photoshop script to crop into square based on active selection

I’m trying to find Java script for photoshop, that will crop to a square based on selection, preserving resolution of the image Selections are irregular

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is very easy and a perfectly valid question. PhotoShop can crop to selection with a function.

cropToSelection();


// crop to selection
function cropToSelection()
{
  executeAction( charIDToTypeID( "Crop" ), new ActionDescriptor(), DialogModes.NO );
}

But if you want the selection bounds coordinates then use:

var lb = get_selection_bounds();

// alerts current selection bounds
alert(lb[0] + ", " + lb[1] + ", " + lb[2] + ", " + lb[3] );


// function GET SELECTION BOUNDS ()
// ----------------------------------------------------------------
function get_selection_bounds()
{
  // Only works with a selection
  var x = parseFloat(app.activeDocument.selection.bounds[0]);
  var y = parseFloat(app.activeDocument.selection.bounds[1]);
  var x1 = parseFloat(app.activeDocument.selection.bounds[2]);
  var y1 = parseFloat(app.activeDocument.selection.bounds[3]);

  // return the results as an array
  return [x, y, x1, y1];
}
about 4 years ago · Juan Pablo Isaza Denunciar
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