Jump to content

php image manipulation: masking


HaLo2FrEeEk

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/74347-php-image-manipulation-masking/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.