Photoshop의 이미지 블렌딩 기법
Photoshop에서 이미지 블렌딩에는 다양한 블렌드 모드를 사용하여 서로 다른 효과를 내는 방식으로 두 이미지를 픽셀 단위로 결합하는 작업이 포함됩니다. 각 혼합 모드는 각 픽셀의 개별 색상 채널(빨간색, 녹색 및 파란색)에서 작동합니다.
Photoshop에서는 특정 매크로를 사용하여 이러한 혼합 모드를 실행합니다.
#define ChannelBlend_Normal(A,B) ((uint8)(A)) #define ChannelBlend_Lighten(A,B) ((uint8)((B > A) ? B:A)) #define ChannelBlend_Darken(A,B) ((uint8)((B > A) ? A:B)) #define ChannelBlend_Multiply(A,B) ((uint8)((A * B) / 255)) #define ChannelBlend_Average(A,B) ((uint8)((A + B) / 2)) #define ChannelBlend_Add(A,B) ((uint8)(min(255, (A + B)))) #define ChannelBlend_Subtract(A,B) ((uint8)((A + B < 255) ? 0:(A + B - 255))) #define ChannelBlend_Difference(A,B) ((uint8)(abs(A - B))) #define ChannelBlend_Negation(A,B) ((uint8)(255 - abs(255 - A - B))) #define ChannelBlend_Screen(A,B) ((uint8)(255 - (((255 - A) * (255 - B)) >> 8))) #define ChannelBlend_Exclusion(A,B) ((uint8)(A + B - 2 * A * B / 255)) #define ChannelBlend_Overlay(A,B) ((uint8)((B < 128) ? (2 * A * B / 255):(255 - 2 * (255 - A) * (255 - B) / 255))) #define ChannelBlend_SoftLight(A,B) ((uint8)((B < 128)?(2*((A>>1)+64))*((float)B/255):(255-(2*(255-((A>>1)+64))*(float)(255-B)/255)))) #define ChannelBlend_HardLight(A,B) (ChannelBlend_Overlay(B,A)) #define ChannelBlend_ColorDodge(A,B) ((uint8)((B == 255) ? B:min(255, ((A << 8 ) / (255 - B))))) #define ChannelBlend_ColorBurn(A,B) ((uint8)((B == 0) ? B:max(0, (255 - ((255 - A) << 8 ) / B)))) #define ChannelBlend_LinearDodge(A,B)(ChannelBlend_Add(A,B)) #define ChannelBlend_LinearBurn(A,B) (ChannelBlend_Subtract(A,B)) #define ChannelBlend_LinearLight(A,B)((uint8)(B < 128)?ChannelBlend_LinearBurn(A,(2 * B)):ChannelBlend_LinearDodge(A,(2 * (B - 128)))) #define ChannelBlend_VividLight(A,B) ((uint8)(B < 128)?ChannelBlend_ColorBurn(A,(2 * B)):ChannelBlend_ColorDodge(A,(2 * (B - 128)))) #define ChannelBlend_PinLight(A,B) ((uint8)(B < 128)?ChannelBlend_Darken(A,(2 * B)):ChannelBlend_Lighten(A,(2 * (B - 128)))) #define ChannelBlend_HardMix(A,B) ((uint8)((ChannelBlend_VividLight(A,B) < 128) ? 0:255)) #define ChannelBlend_Reflect(A,B) ((uint8)((B == 255) ? B:min(255, (A * A / (255 - B))))) #define ChannelBlend_Glow(A,B) (ChannelBlend_Reflect(B,A)) #define ChannelBlend_Phoenix(A,B) ((uint8)(min(A,B) - max(A,B) + 255))
RGB를 혼합하려면 다음 매크로를 사용하는 픽셀:
ImageTColorR = ChannelBlend_Glow(ImageAColorR, ImageBColorR); ImageTColorB = ChannelBlend_Glow(ImageAColorB, ImageBColorB); ImageTColorG = ChannelBlend_Glow(ImageAColorG, ImageBColorG); ImageTColor = RGB(ImageTColorR, ImageTColorB, ImageTColorG);
불투명도를 원하는 경우(50% 불투명도):
ImageTColorR = ChannelBlend_AlphaF(ImageAColorR, ImageBColorR, Blend_Subtract, 0.5F);
버퍼를 사용하면 세 가지 색상 채널 모두에 대한 혼합을 단순화할 수 있습니다.
#define ColorBlend_Buffer(T,A,B,M) (T)[0] = ChannelBlend_##M((A)[0], (B)[0]), (T)[1] = ChannelBlend_##M((A)[1], (B)[1]), (T)[2] = ChannelBlend_##M((A)[2], (B)[2])
공통 혼합 모드용 매크로:
#define ColorBlend_Normal(T,A,B) (ColorBlend_Buffer(T,A,B,Normal)) #define ColorBlend_Lighten(T,A,B) (ColorBlend_Buffer(T,A,B,Lighten)) #define ColorBlend_Darken(T,A,B) (ColorBlend_Buffer(T,A,B,Darken)) #define ColorBlend_Multiply(T,A,B) (ColorBlend_Buffer(T,A,B,Multiply)) #define ColorBlend_Average(T,A,B) (ColorBlend_Buffer(T,A,B,Average)) #define ColorBlend_Add(T,A,B) (ColorBlend_Buffer(T,A,B,Add)) #define ColorBlend_Subtract(T,A,B) (ColorBlend_Buffer(T,A,B,Subtract)) #define ColorBlend_Difference(T,A,B) (ColorBlend_Buffer(T,A,B,Difference)) #define ColorBlend_Negation(T,A,B) (ColorBlend_Buffer(T,A,B,Negation)) #define ColorBlend_Screen(T,A,B) (ColorBlend_Buffer(T,A,B,Screen))
위 내용은 Photoshop에서는 매크로를 사용하여 다양한 블렌드 모드를 어떻게 달성합니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!