본문 바로가기

업무/AHK 업무 간소화

AHK 이미지 회전 4:3 비율의 크기 안에 이미지를 가장 크게 넣을 수 있는 각도를 확인하여 돌려줍니다.

 

4:3 비율의 상품 사진

 

4:3 비율의 크기 안에 이미지를 가장 크게 넣을 수 있는 각도를 확인하여 돌려줍니다.

 

일반적인 모양의 신발은 거의 비슷한 각도가 나오지만

발목길이가 높은 하이탑과

발볼 길이가 짧거나 없는 슬립온, 슬리퍼 등은 개별적으로 추가 수정이 필요했으나 

 

이미지의 가로 세로 크기 정보를 가져와

 

3200x2400 px 또는

1600x1200 px 의 크기안에서 가장 크게 들어갈 수 있는 최적의 각도를 자동으로 확인하여

이미지릐 회전을 처리해줍니다

 

 

원본사진

 

 

배경정리

 

 

 

CoordMode, mouse, screen
CoordMode, Pixel, screen

SetTitleMatchMode, 2

f6::

loop,
{
RUN, C:\Program Files\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe
WinWait, Layer,
IfWinNotActive, Layer, , WinActivate, Layer,
WinWaitActive, Layer,
Sleep, 700

Send, ^!i
Sleep, 700
Send, ^c
width=%Clipboard%

Send, {tab}
Sleep, 100
Send, {tab}
Sleep, 100
Send, ^c
height=%Clipboard%

Send, {esc}
Sleep, 500
;~ MsgBox, %width% " " %height%
wh:=width/height
;~ StringLeft, wh, wh, 4
ToolTip, %wh% / 1.34

global whangle:= (wh-1.34)*30

if (wh > 1.35 or wh < 1.33)
{
rotate(whangle)
}
else
{
가로세로변경()
break
}
}
return

가로세로변경()
{
Send, ^!i
Sleep, 300
SendInput, 1575
Sleep, 50
Send, {enter}
Sleep, 1000

Send, ^!c
Sleep, 300
Send, {tab}
SendInput, 1600
Send, {tab}
Send, {tab}
SendInput, 1200
Send, {enter}
}

rotate(angle)
{

RUN, C:\Program Files\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe
WinWait, Layer, 
IfWinNotActive, Layer, , WinActivate, Layer, 
WinWaitActive, Layer, 

Send, !i
Sleep, 50
Send, g
Sleep, 50
Send, a
Sleep, 50
Send, %angle%
Sleep, 50
Send, {tab}
Sleep, 50
Send, {Space}
Sleep, 50
Send, {Enter}
Sleep, 1000

RUN, C:\Program Files\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe
WinWait, Layer, 
IfWinNotActive, Layer, , WinActivate, Layer, 
WinWaitActive, Layer, 

Send, !i
Sleep, 50
Send, r
Sleep, 50
Send, {Enter}

}

f10::Pause
F11::Reload
f12::ExitApp

 

 

 

1600x1200 px 안에 삽입

 

 

 

'업무 > AHK 업무 간소화' 카테고리의 다른 글

AHK 입력키 3개로 실행  (0) 2020.11.26