Unity 2D: Make an image completely black - unity3d

I need to make a copy of an image and make it completely black (silhouette) at runtime. Just changing the color to black doesn't do the trick, for a reason Unity makes some lines transparent:

Its because your image is not completely filled and has gaps where those "lines" can be seen

Related

Google Maps Tile Cutter forcing white background

I am using leaflet. Since I cannot use image-overlay due to memory usage and zooming being slow on some browsers I would like to use two tile-layers.
This seems to work perfectly, but the only thing I cannot fix is getting my tiles to be transparent. Whenever I cut them in Photoshop by using Bramus' tile cutter script it automatically adds a white background.
Does anyone know how to solve this?
https://www.bram.us/2012/04/23/photoshop-google-maps-tile-cutter-script/
That's the script I am using.
So basically what I want is the tiles being cut exactly as this script does, but with a transparent background.
I tried removing the white background by using ImageMagick but that still leaves me with some pixels in various shades of grey around the black area's unfortunately so that is not working either.
for /R "C:\Users\<USERNAME>\Desktop\map\name" %I in (*.png) do magick "%I" -fuzz 0.3%% -transparent #FFFFFF "%I"
Original image
After ImageMagick - added green BG for reference
After ImageMagick original
I tried adding -trim, but then I still have edges around my arrows, and sometimes (see original image below) it even deleted the gray area with the black top-border.
Anyways, is there a alternative for my Photoshop script so I can still generate tiles but transparent? I couldn't really find one.

Incorrect white matte behind antialiasing on imported sprites

I'm importing a sprite into Unity, and adding it to a Screen Space Overlay canvas to use for a UI.
The image I'm importing looks exactly as I want it, but in Unity the anti-aliased edges look like they're going to a white background color, instead of just fading over whatever is actually behind them.
I'm using these import settings:
I'm using a default UI/Image component to add it to the canvas.
This is the image I'm importing - it's a 32 bit PNG exported from Fireworks: (also shown over a black background)
Just to confirm, this looks fine everywhere else in Unity, preview panels, pickers etc. I am packing this sprite using the built in Sprite Packer if that changes anything.
And the final result:
How can I get rid of these artifacts on the corners?
The problem was the RGB values of the transparent pixels. By default they are white, and any scaling operations cause this white color to be blended with the partially transparent pixels.
I essentially made a slightly larger version of the button background shape, put it in a layer behind everything, and then wrote back into the alpha channel making it transparent. This means that the neighboring pixels are then the same color as the partially transparent ones.
The end result:

transparent color to white for an UIImage

I realised that all my png images are defined with a transparent color instead of white color. I never noticed because the background of my app was white but now is of a different color. And as I cannot edit each single png file to replace the transparent color to white, I am looking for a simple programmatic way of replacing on the fly the transparent color by a white color. How should I do this please?
Thanks for any help
Cheers,
geebee
If I understand what you're trying to do, I would suggest you add a white background to your UIImageViews.
self.myImageView.backgroundColor = [UIColor whiteColor];
I don't see why you can't just "edit each single png file"; it's a pretty much instant batch operation using GraphicConverter or ImageMagick or whatever.
If you really insist on compensating for this on the device when the image loads, then just draw the image onto a white opaque rectangle and use the resulting composite image.

How to create an art asset that can be dynamically colored in software?

I asked this question on the Graphic Design site, but it includes a programming component that might be better answered here.
Specifically, I have a bunch of photographic crayon images. I would like to remove the color from one to produce a neutral image that I can load into an iPhone app that I'm writing and dynamically color. The crayon images have dark regions (shadows) and light regions (shine) which I would like to preserve. I will be dynamically coloring it with many different colors, ranging from white to rainbow colors to black.
My first inclination is to turn the image into a grayscale image and then somehow turn the color channel into an alpha channel, and change the color of all pixels to black. Then I could use it as a mask. However, this would only preserve the shadows, and I would lose all the highlights.
Any ideas?
Two options come to mind:
Make a grayscale version that could be tinted as you said, with the shadows and highlights simply white and gray.
Make an outline, i.e. an image with alpha that had 0% opacity in the colored parts, say 10% white over the highlights, 10% black on the shadows, and 100% black/dark gray for the lines/edges. The idea being that you could put any color under the outline and it would look right.

OpenGLES mix and match blending options complicated question

So I have a background line drawing, black and white. I want to be able to draw over this, keeping the black lines in there, and drawing only where it is white. I can do this by using
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
And the black stays black and white gets whatever color I want. However in the white areas, I want to be able to draw some color, pick to another color and then blend. However this doesn't work because the blend function is messed up.
So what I was thinking is having a linedrawing framebuffer, and a user-drawing framebuffer. The user draws into the userdrawing framebuffer, with a different blending, and then I switch blending options and draw into the linedrawing framebuffer. But i don't know enough OpenGL to say whether or not this will work or is a stupid idea.
Thanks a lot
If your drawing is transparent in the white regions, you can do this: Draw your colored areas first and then the line drawing over them, using the standard GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA blend.