indesign (CS5)에서 선택한 이미지/그룹의 길이와 너비를 출력하고 .png 파일에 선택 사항을 저장하는 자바 스크립트 애플리케이션을 작성하려고합니다. 문제는 선택 영역의 visibleBounds를 사용하여 생성하는 길이와 너비가 내 보낸 이미지의 길이와 너비와 약간 다릅니다. 보다 구체적으로 이미지 높이가 너비보다 크면 생성 된 높이가 결과 .png의 높이와 같지만 생성 된 너비가 약간 더 작아집니다. 반대로 폭이 더 크면 생성 된 높이가 약간 더 작아집니다. 다음은 함께 작업 한 코드입니다.올바른 길이와 너비를 가져 와서 내보내는 indesign
dest = Folder.selectDialog('Save report');
selected = app.activeDocument.selection[0];
filer = new File (dest+'/'+'testImage.png');
h = selected.visibleBounds[2] - selected.visibleBounds[0];
w = selected.visibleBounds[3] - selected.visibleBounds[1];
alert('height: '+h+'\nwidth: '+w);
selected.exportFile(ExportFormat.PNG_FORMAT, filer, false);
이 문제는 비교적 작은 이미지에서만 발생합니다. 이미지가 작을수록 영향이 클 것 같습니다. 어떤 도움이라도 대단히 감사하겠습니다.
visibleBounds 대신 geometricBounds를 사용해 보았습니까? – fabianmoronzirfas
그래, geometricBounds는 정확한 결과를 제공합니다 :/ –
hm. 스크립트가 사용하는 단위를 설정하려고 시도했을 수 있습니다. http://jongware.mit.edu/idcs5/pc_ViewPreference.html app.activeDocument.viewPreferences.properties = { horizontalMeasurementUnits : MeasurementUnits.MILLIMETERS, 의 verticalMeasurementUnits = MeasurementUnits.MILLIMETERS의 } – fabianmoronzirfas