Is it possible to Flood Fill image with another image in ios? - ios

I have this example https://github.com/Chintan-Dave/UIImageScanlineFloodfill
and read this post also: UIImage fill transparent part with another image
But not getting result!!
I have one image. In this image when we touch any portion of that image fill that portion with another image instead of colour.
so if anybody have any idea or example than please help me.
I tried using
imageView.newcolor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"pattern4.png"]];
but image fill with black color.
I want exactly this type of image, above flood fill example fill only single color in image but I want to fill with pattern or another image like below.

Related

Crop text image within background using OpenCV

I would like to extract the letter from the blue images shown below.
Ideally, the result would be a cropped black letter image on a white background as shown below.
There may be functions of CV that would enable me to go this effectively.
I think this would be a more simple thing to do if the original letters weren't white. It would be more simple to crop the image to the extent of the letter and change the font color to black.
Appreciate any help.
Image example 1
Image example 2
Result

How to convert uitextview' text into a mask on a background image in iOS

I am trying to create uitextview' text as a mask for background image so that I can color text dynamically with respect to the image behind. I can make that thing through the design application by converting text into outline paths and use it as a mask to the background image. Here is the link for a sample text
However fail to do that in iOS, as I need to convert textview text into path which is somewhat very problematic for me.
I would be happy if someone at least show me the general way to do that.
Thanks
You can place the uitextview (with a black text) on a white background and take a snapshot of that view, like this:
How Do I Take a Screen Shot of a UIView?
Then, you can use the resulting image as a mask on your background image, like this: How to Mask an UIImageView
I hope this helps. Good Luck!

iOS detect color inside UIImage and crop

I'm trying to figure out the best way to approach this. I'm looking to take an UIImage, detect if there are any shapes/blobs of a specific RGB color, find their frame and crop them into their own image. I've seen a few posts of people recommending OpenCV as well as other links similar to this - Link
Here are 2 screenshot's of what I'm looking to do. So in Example 1 there is the light blue rectangle with some text inside it. I need to detect the blue background and crop the image along the black lines. Same for the red image below it. This is just showing that it doesn't matter what's inside of the color blob. Example 2 shows the actual images that will be cropped once the 2 color blobs are found and cropped. All image will always be on a white background.
Example 1
Example 2
This question goes way beyond a simple answer. What you will need to do is access the raw data on that image based on the color then create a frame to crop. I would find the upper, left,right, lower frame of all matches of that specific color then make a frame out of it to crop the image.
Access the color
Get Pixel color of UIImage
Crop the image
Cropping an UIImage

Uiactivty image Not Appearing in iOS

I am implementing UIActivtyViewController and I want to add whatsApp image to that. (http://a598.phobos.apple.com/us/r30/Purple/v4/fa/a8/02/faa80212-7d5b-f8a2-0e86-22d619ef6dc2/mzl.cmjuugpr.png) Adusted frame 60x60.
but I am not getting As I excepted, I am getting like following message.
what i have to do display correct image thanks in advance.
You can only play with transparency. Colors are ignored. That's why you are getting a solid rectangle. Documentation says:
The alpha channel of the image is used as a mask to generate the final
image that is presented to the user. Any color data in the image
itself is ignored.

Highlight(Overlay) specific area on UIImage

I am developing a book app. Book pages are images. At a time one image is shown on iphone screen. Image contains lines(Paragraphs). I want to highlight the whole paragraph on touch on that. Is it possible to highlight the paragraph or make overlay on the whole paragraph or change the color of that paragraph. Any Help please?
As your book page is an image, the only way you can do it is to either change the image or add a view on top with a color and an alpha value. With the latter you also overlay the letters of course, so the effect will kind of blurry your text.
Next to that, recognising the paragraph won't be trivial, depending on your image quality. The same counts for changing the image - if your background is not a clean color you have to introduce some threshold for which color is the background color and should be changed to the highlight color.
For how to change the color of specific pixels in an UIImage see here:
iPhone : How to change color of particular pixel of a UIImage?

Resources