IMAGECOLORSTOTAL(3) 1 IMAGECOLORSTOTAL(3)imagecolorstotal - Find out the number of colors in an image's paletteSYNOPSIS
int imagecolorstotal (resource $image)
DESCRIPTION
Returns the number of colors in an image palette.
PARAMETERS
o $image
- An image resource, returned by one of the image creation functions, such as imagecreatefromgif(3).
RETURN VALUES
Returns the number of colors in the specified image's palette or 0 for truecolor images.
EXAMPLES
Example #1
Getting total number of colors in an image using imagecolorstotal(3)
<?php
// Create image instance
$im = imagecreatefromgif('php.gif');
echo 'Total colors in image: ' . imagecolorstotal($im);
// Free image
imagedestroy($im);
?>
The above example will output something similar to:
Total colors in image: 128
SEE ALSO imagecolorat(3), imagecolorsforindex(3), imageistruecolor(3).
PHP Documentation Group IMAGECOLORSTOTAL(3)
Check Out this Related Man Page
IMAGECOLOREXACTALPHA(3) 1 IMAGECOLOREXACTALPHA(3)imagecolorexactalpha - Get the index of the specified color + alphaSYNOPSIS
int imagecolorexactalpha (resource $image, int $red, int $green, int $blue, int $alpha)
DESCRIPTION
Returns the index of the specified color+alpha in the palette of the image.
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
o $red
-Value of red component.
o $green
-Value of green component.
o $blue
-Value of blue component.
o $alpha
- A value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.
The colors parameters are integers between 0 and 255 or hexadecimals between 0x00 and 0xFF.
RETURN VALUES
Returns the index of the specified color+alpha in the palette of the image, or -1 if the color does not exist in the image's palette.
EXAMPLES
Example #1
Get colors from the GD logo
<?php
// Setup an image
$im = imagecreatefrompng('./gdlogo.png');
$colors = Array();
$colors[] = imagecolorexactalpha($im, 255, 0, 0, 0);
$colors[] = imagecolorexactalpha($im, 0, 0, 0, 127);
$colors[] = imagecolorexactalpha($im, 255, 255, 255, 55);
$colors[] = imagecolorexactalpha($im, 100, 255, 52, 20);
print_r($colors);
// Free from memory
imagedestroy($im);
?>
The above example will output something similar to:
Array
(
[0] => 16711680
[1] => 2130706432
[2] => 939524095
[3] => 342163252
)
NOTES
Note
This function requires GD 2.0.1 or later (2.0.28 or later is recommended).
SEE ALSO imagecolorclosestalpha(3).
PHP Documentation Group IMAGECOLOREXACTALPHA(3)
I would like to insert a .gif image into a text file that is generated by a Unix-based database application.
Can anyone please tell me how I can achieve this? (7 Replies)
Hi UNIX gurus :) ,
I have the following requirement and not being able to find a solution :( .
i have got a file demo.lst
movies 10 12 25
songs 11 8 15
DVD 15 12 10
Total 58 60 75
NOTE:-Total value not the sum of the columns but some predefined value.
My... (5 Replies)
Dear All,
i have a file that contains,
FROM_DATE: 06-08-2007 00:00:00 TO_DATE: 06-08-2007 23:59:59 Total number of lines: 6874154
in another file,the contain is,
FROM_DATE: 06-08-2007 00:00:00 Total number of lines: 874154
alltime i want to find the particular string... (4 Replies)
a) Total number of words in the file.
b) Total number of different words in the file.
How can I use the translate and/or unique commands to accomplish this (4 Replies)
Discussion started by: EECSDAVE
4 Replies
5. Post Here to Contact Site Administrators and Moderators
Hi Admin, i just noticed that when I do postings, the number does not increment. eg :
Post A -Total Posts 312
Post B - Total Posts 312
Post C - Total Posts 313
Post D - Total Posts 313
Why is this so? Can you kindly check this out? Thank you. (5 Replies)
I have several systems which require software maintenance several times a year. After the software maintenance, it is required that we make two system tapes for DR purposes. The creation of these system tapes takes anywhere from 1-1.5 hours because of the performance of the tape drives. What I... (7 Replies)
Hi,
I have grep:ed on a file with which gives the below output.
Total = 43
Total = 21
Total = 23
Total = 2
Total = 3
Total = 1
Total = 0
I would like to add the first 4th lines to a total amount, and do so on for the rest of the lines.
I was thinking in terms of using while read.... (32 Replies)
Hello,
I have two txt files that look like this:
db.0.0.0.0:
Total number of NS records = 1
db.127.0.0.0:
Total number of NS records = 1
Total number of PTR records = 1
db.172.19.0.0:
Total number of NS records = 1
Total number of PTR records = 3
db.172.19.59.0:
Total... (8 Replies)
Hi,
How to decode an image using openGL library libjpeg ..
which are the steps needed to do this using C language..
actually my work is to decode the image, store it on the buffer,
and place it on cube surface..
please guide me,,any answer will appreciated .. (8 Replies)
Hi everyone, I am all new to this and I might not know what I am asking about :)
I have access to a cPanel with cron tab scheduler. I know nothing re scripting creating php etc..
I own a ftp mainly for own email address, some storage, and a forum (ready-made one :P )
I have some knowledge... (5 Replies)
I 'm new to linux .. can some one tell how can we create a linux image like solaris flash archive and then use it with kickstart server to build multiple clients
from same image ?
Thanks (4 Replies)
Hi guys!
I need to upgrade the fw version of some T2000 servers, but unfortunately the image downloaded from the Oracle does not work...it seems that the image is not supported on the platform..
bash-3.00$ uname -a
SunOS adm01 5.10 Generic_141414-07 sun4v sparc SUNW,Sun-Fire-T200... (5 Replies)
Hi Experts,
I am very new to AIX, I have a mksysb image in one of my aix server (V6), I would like to install this mksysb image on newly lpar. Is it possible without tape and NIM?
Advice would be appreciated.
Regards,
Rockie (11 Replies)