2011-12-14 4 views
10

나는 이미지와 HTML 이미지 맵을 링크 및 텍스트에 넣었다. 그건 잘 작동합니다. 이미지의 특정 영역에 마우스를 올리면 효과가 나타납니다. 예를 들어 세계지도를 가져 가면 강조 표시된 국가 위로 마우스를 가져갑니다. html 이미지 맵과 일부 CSS에서는 문제가되지 않습니다. 즉, 모든 국가의 모든 다각형 좌표 목록이있는 경우입니다.특정 이미지 영역의 모든 다각형 좌표를 가져 오는 중입니까?

그럼 어떻게받을 수 있습니까? 당신은 그것을 수동으로 할 수 없습니다.

저는 포토샵 전문가는 아니지만 지역에서 "마술 지팡이"선택을 한 다음 선택을 만드는 데 사용 된 좌표를 어떻게 든 나열한다고 상상합니다. 그러한 기능이 있습니까?

나는 개인적으로 간단한 이미지 편집을 위해 Paint.Net을 사용하며, 내가 아는 그 기능을 가지고 있지 않다.

이 방법은 알고 계십니까?

+0

좋은 질문입니다, + vote from me. – Hoque

+0

그래서 [[this]] (http://davidlynch.org/projects/maphilight/docs/demo_world.html)와 같은 것을 원하십니까? 나는 자바, 또는 jQuery와 같은 것을 사용하는 것을 생각할 것이다. 보십시오 [여기] (http://davidlynch.org/projects/maphilight/docs/) 어쩌면. 도움이 될지 모르지만 뭔가 있습니다. – ACarter

답변

0

ps에는 Dreamweaver에서 좌표를 지정해야하는 옵션이 없습니다.

4

프로그래밍 Q/A 사이트이므로 JavaScript로 작성하는 방법을 알려 드리겠습니다.

#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 좌표로 변환하기에 충분한 정보 여야합니다.

#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; 

지침 :

- 오픈지도

는 경로와 출력이 스크립트를 사용하여 경로의 각 pathPoint.anchor로 선택을 할 수있는 개별 다각형 점의 좌표를 얻으려면 너무 수정 ExtendScript으로 스크립트 -run 당신의 마음에 드는 선택 도구

를 사용하여 지역의 선택 -make 이미지

lkit을 선택하거나 파일> 스크립트> 찾아보기 ...를 선택하고 스크립트가 저장된 .jsx 파일을 선택하십시오.

+0

죄송합니다. 새로운 답변을 게시했지만 귀하의 게시물에 댓글을 달 수없는 것 같습니다. 좌표를 텍스트 파일에 쓰도록 코드를 수정하는 방법을 설명 할 수 있습니까? 나는 Photoshop thanx nvm 내의 경고에서 그들을 복사 할 수있을 것 같아서 알았습니다 : 경고 (coords) 행 다음에이 파일을 추가했습니다. var f = File ('~/Desktop/test/coords.txt'); f.open ('w'); f.write (coords); f.close(); 부적절한 경우 게시물을 삭제 해 주시기 바랍니다. – krasatos

+1

그래, 알림은 복사/붙여 넣기가 가능합니다. 죄송합니다. 당신의 방법은 작동하거나'$ .write (coords)'를 사용하여 콘솔을 extendscripts로 출력 할 수 있습니다. – pdizz

관련 문제