php - How to pick a color to make transparent in images? -


The first question, please be gentle; -)

I have written an image class that makes things simple (rectangle, text) a little easier, basically a bunch of wrapper methods for PHP picture functions.
What I am now trying to do, allow the user to define a selection, and the following image operations are affected only by the selected area I thought I would copy the image and delete the selected area I do this, as the original image originates as usual, when $ img-> unselected () is called, copy the imgTwo back to the original, and delete the copy.

  • Is this the best way? Obviously this would be difficult to define unselected areas in a selected area, but I can live with it for now :)

Then, by the way I choose to copy I am drawing that drawing a rectangle in a transparent color, which is working - but I can not understand that choose when the color is being ensured that it is in the rest of the image Does not come. The input images in this application are true color PNG, so there is no palette with color index (I think?).

  • There should be a better way than to collect the colors of each individual pixel, then finding a color that does not appear in $ existing_colors array .. okay? PNG transparency works in GIF transparency in a different way - you have to design a particular color. There is no need to define as transparent. Just use and make sure that you have set to false :

      // "0, 0, 0" anything can happen; 127 = Fully Transparent $ c = imagecoloralllectalpha ($ img, 0, 0, 0, 127); // Set it to set it to overwrite the rectangle instead of drawing at the top. Improved Folding ($ img, false); ImageFilterText ($ IMG, $ x, $ y, $ width - 1, $ height - 1, $ c);  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -