Page 1 of 1
text color background color
Posted: 2013-08-18T00:33:41-07:00
by appollosputnik
I want to extract text color and background color from a PNG file. PLease help me how can I do it. Thanks Sujan
Re: text color background color
Posted: 2013-08-18T01:06:31-07:00
by Bonzo
You need to add more information: Platform, IM version and programming language you want to use as well as an example..
Re: text color background color
Posted: 2013-08-18T01:27:05-07:00
by appollosputnik
I am trying to get the image's backgroun color using python - pythonMagick. How can I get the RGB values of the current background.
Code: Select all
im2 = PythonMagick.Image('myimage.png')
bgColor = im2.backgroundColor().to_std_string()
print bgColor
Re: text color background color
Posted: 2013-08-18T02:40:22-07:00
by appollosputnik
I am working in Linux Ubuntu with python 2.7.5 and pythonMagick. Please help me how can I get the background color of my image.?? My image is a converted PDF to PNG. It has text and background color. Generally the background color is white but sometimes the background color is other (green, blue, red etc)...How can I get the background color.
I actually want to calculated the contrast of my PDF file. So trying to convert it into an image then extract the background color. please help. Thanks Sujan
Code: Select all
im2 = PythonMagick.Image('myimage.png')
bgColor = im2.backgroundColor
red = bgColor.redQuantum()
green = bgColor.greenQuantum()
blue = bgColor.blueQuantum()
Re: text color background color
Posted: 2013-08-18T07:41:29-07:00
by snibgo
It would help if you provided an example image.
What distinguishes text from background? Are they solid colours, with or without antialiasing? Pehaps histogram would help, giving the two most common colours.