Ti dirò come farlo con JavaScript, poiché si tratta di un sito di programmazione Q/A.
Per ottenere le coordinate rettangolari dei limiti di selezione è semplice:
#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;
Questo darà i limiti rettangolari (si pensi del rettangolo di selezione che si vede quando la trasformazione) della selezione nel documento attivo corrente. Emette nell'ordine minX, minY, maxX, maxY. Questo dovrebbe essere abbastanza informazioni per tradurre in coordinate CSS.
Per ottenere le coordinate dei singoli punti del poligono è possibile effettuare la selezione in un tracciato e uscita ogni pathPoint.anchor sul percorso utilizzando questo 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;
Istruzioni:
-open vostra mappa immagine
-fare una selezione della regione, utilizzando lo strumento di selezione preferita
-Eseguire lo script con l'ExtendScript troppo lkit o scegliendo File> Script> Sfoglia ... e selezionare il file .jsx in cui è salvato lo script.
Buona domanda, + voto da parte mia. – Hoque
Quindi vuoi qualcosa di simile a [questo] (http://davidlynch.org/projects/maphilight/docs/demo_world.html)? Penserei di usare qualcosa come Java o jQuery. Dai un'occhiata [qui] (http://davidlynch.org/projects/maphilight/docs/) forse. Non so se sarà d'aiuto, ma è qualcosa. – ACarter