Avoid background color in image c# - image-processing

I have a image processing in my uwp app where i read the colors of the image and display the results based on the matching colors.
To read the colors i use Color theif and get the color palette.
The problem is at times the background color is considered as the primary color since it is dominent
In the above image the second color must be the primary color of the image which i need. But the gray is obtained as primary color.

Since image background could be of any color, I think the best bet is to pick colors from the corners of an image (which more likely to be of background color) and compare them against the colors of the palette returned by ColorThief using the Color difference formula.
You could then use color differences and the amounts of times the color from ColorThief palette was a match to corner pixel color as weight coefficients to decide which one of the ColorThief palette colors is more likely to be the background color of the image.

Related

Blending white colors in images

I need to modify any image to get these results:
White color has to be the color I specify, I don't want to keep source image's lightness.
Rest of colors have to be tinted similar to Photoshop's "Color" layer blend mode. That is, I need them to look like if the source image was grey-scaled and then a color filter applied, even for non-greyscale images.
I am using the UIImage + Colorize.swift functions. The tint(tintColor: UIColor) -> UIImage function works as I need for non-white colors, but white color remains white. How could I get the results I need?

Is that possible to change the color of icons used in app according to selected theme in app in objective c.(programmatically)

I need to change the color of sliced icons used in app in different color. I dont want to take more and more images i.e. of different color. I want to change the color of image only, not other properties of image e.g. shape, size, layer, opacity etc. Is that possible?
If you construct your icons correctly, you can use the Hue Adjust CIFilter. You'd just need to change the inputAngle to get the color you want. For example, if your icon is mostly blue, you can make a mostly yellow one by changing inputAngle to 180° (or π radians - not sure of the units).

iOS Color Aberration / Color Fringing Effect

Trying to think of a way to create color aberration (also known as color fringing) effect in black and white images on iOS but i can't figure out how. I want to create the Before effect .
Images will be passed through a filter chain with CIMaximumComponent or CIMinimumComponent for the black and white effect.
Is color aberration doable with Core Image filters? Any ideas?

How do I select by color, and then stroke selection?

I've got a UIImage with black text on it and I'd like to add a "glow" effect around the letters of the text. In a graphics editing program such as GIMP or photoshop I can select by color and stroke the selection with the current brush to get the glow effect. I know how to stroke a path, but how can I select by color in obj-c?
You can't just 'select by color'.
From your description I would look at using mask images. Take a copy of your image, scale and blur it and use that to mask a color wash.
If that won't work due to other contents in your image then you will need to look at flood fill algorithms (which is a potential basis of 'select a color' implementations).

Remove Transparency From Glyph.Data in SpeedButtons

I have an old app (Delphi 5) which I want to give it some changes.
I have set a Glyph.Data for a speedbutton, but some colors are transparent and in some places I see small white dots on my image, I do not want to set transparency for the image, How to remove it (transparency)?
Any help is really appreciated.
Thanks :)
The transparency is a color that is not drawn.
You just have to change the image or set another color as the transparent one.
From Delphi 6 Help
Transparent color
Use the Transparent color drop-down to
specify which color is used to create
a mask for drawing the image
transparently. The default transparent
color is the color of the bitmap's
left-most pixel in the bottom line.
You can also change the transparent
color by clicking directly on a pixel
in the selected image.
When an image has a transparent color,
any pixels in the image of that color
are not rendered in that color, but
instead appear transparent, allowing
whatever is behind the image to show
through.
If the image is an icon, Transparent
color appears grayed and the
transparent color is set to clNone.
This is because icons are already
masked.
Set TSpeedButton.Transparent to False.
I have found the answer, Delphi thinks the transparent color is the color of most left - bottom pixel of this image. So If I set a color which is not used in my image in the most left-bottom of my image, then Delphi only will make that small pixel transparent and other parts of my image will be OK without transparency, So this post is completed by myself :))

Resources