madrazel Posted October 30, 2006 Share Posted October 30, 2006 $whatever = imagecreatefrompng('somefile.png');now i want to know how many colors are actually in this file, not how many colors is this format capable to contain, like truecolor etc... not thisin my script i use program to make some png images from command line (a full-length rendering of a html page to png), but this program has very annoying bug that it sometimest returns a blank image, so i want to track somehow these images having only one fill colorhow to do this ? many graphical programs have this function ? Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 30, 2006 Share Posted October 30, 2006 The image files themselves don't contain that data explicitly. You would need to find a way to examine each pixel and build the data. I'm not sure about PNG, but with something like jpeg that may not be even possible because of the way the data is stored there is no individual pixel assignments. Even if all of this is possible, it would be a huge resource hog.I would suggest you use the size (data size not dimensions) as a way of determining if the image is blank or not. That would be very easy to determine. Quote Link to comment 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.