Ответ 1
Я расскажу вам, как это сделать с помощью JavaScript, поскольку это сайт программирования Q/A.
Чтобы получить прямоугольные координаты границ выбора, проще всего:
#target photoshop
// Save the current unit preferences (optional)
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
// Set units to PIXELS
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
// Use the top-most document
var doc = app.activeDocument;
var coords = doc.selection.bounds;
// Write coords to textfile on the desktop. Thanks krasatos
var f = File( '~/Desktop/coords.txt' );
f.open( 'w' );
f.write( coords );
f.close();
// Reset to previous unit prefs (optional)
app.preferences.rulerUnits = startRulerUnits;
app.preferences.typeUnits = startTypeUnits;
Это даст прямоугольные границы (подумайте об ограничивающей рамке, которую вы видите при преобразовании) выделения в текущем активном документе. Он выводится в порядке minX, minY, maxX, maxY. Этого должно быть достаточно для перевода в координаты CSS.
Чтобы получить координаты отдельных точек полигона, вы можете сделать выбор в путь и вывести каждый pathPoint.anchor по пути, используя этот script:
#target photoshop
// Save the current unit preferences (optional)
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
// Set units to PIXELS
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
// Use the top-most document
var doc = app.activeDocument;
// Turn the selection into a work path and give it reference
doc.selection.makeWorkPath();
var wPath = doc.pathItems['Work Path'];
// This will be a string with the final output coordinates
var coords = '';
// Loop through all path points and add their anchor coordinates to the output text
for (var i=0; i<wPath.subPathItems[0].pathPoints.length; i++) {
coords += wPath.subPathItems[0].pathPoints[i].anchor + "\n";
}
// Write coords to textfile on the desktop. Thanks krasatos
var f = File( '~/Desktop/coords.txt' );
f.open( 'w' );
f.write( coords );
f.close();
// Remove the work path
wPath.remove();
// Reset to previous unit prefs (optional)
app.preferences.rulerUnits = startRulerUnits;
app.preferences.typeUnits = startTypeUnits;
Инструкция:
-открыть изображение вашей карты
-make выбор области с помощью вашего любимого инструмента выбора
-run script с помощью инструментария extendscript или выбрав "Файл" > "Сценарии" > "Обзор"... и выберите файл .jsx, в котором сохранен script.