HaLo2FrEeEk Posted October 22, 2007 Share Posted October 22, 2007 Does anyone know of the top of their head if there is a function built in to php that will allow me to apply image masks to an image? If you don't know what a mask is, it is a black or whitelayer on an image that is interpretted into either opaque or transparent. I need to take a base image and cut it out on the fly (the image will be different every time in style, and color) leaving just a certain part of the image, the rest will be transparent. If there is no built in function, then can anyone refer me to a class created for this purpose? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/74347-php-image-manipulation-masking/ Share on other sites More sharing options...
Barand Posted October 22, 2007 Share Posted October 22, 2007 Well, if you have, say, an image and your mask image is same size but with white background with a blue circle in the middle (the mask) pseudocode for x = 0 to imagewidth for y = 0 to imageheight if pixel at xy in mask is white then output white pixel in output image (or other transparent color) else copy pixel color from image at xy to output image end if end for end for Quote Link to comment https://forums.phpfreaks.com/topic/74347-php-image-manipulation-masking/#findComment-375656 Share on other sites More sharing options...
HaLo2FrEeEk Posted October 22, 2007 Author Share Posted October 22, 2007 That would take forever though, going through every pixel. I'm looking for something a little faster and less straining on the server. The base picure I'm working on is a little too big to go through pixel by pixel. Quote Link to comment https://forums.phpfreaks.com/topic/74347-php-image-manipulation-masking/#findComment-375687 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.