alpha-transparency
How to create a semi transparent shape?
The image below illustrates transparency using OpenCV. You need to do an alpha blend between the image and the rectangle. Below is the code for one way to do this. #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> int main( int argc, char** argv ) { cv::Mat image = cv::imread(“IMG_2083s.png”); cv::Mat roi = image(cv::Rect(100, 100, 300, 300)); cv::Mat color(roi.size(), … Read more
Is there a way to set drawable’s Alpha using XML?
It’s been a while since the OP, but personally found a solution that worked a lot better for me than the suggested answers. Creating a BitmapDrawable makes is easily possible to set the alpha: <?xml version=”1.0″ encoding=”utf-8″?> <bitmap xmlns:android=”http://schemas.android.com/apk/res/android” android:src=”https://stackoverflow.com/questions/8179250/@drawable/your_drawble” android:alpha=”77″> </bitmap> Alpha can be any value between 0 and 255. Note that it is … Read more
Replace transparency in PNG image with white background
-background white -alpha remove -alpha off Example: convert image.png -background white -alpha remove -alpha off white.png Feel free to replace white with any other color you want. Imagemagick documentation says this about the -alpha remove operation: This operation is simple and fast, and does the job without needing any extra memory use, or other side … Read more
Convert Transparent PNG to JPG with Non-Black Background Color
// Assumes myImage is the PNG you are converting using (var b = new Bitmap(myImage.Width, myImage.Height)) { b.SetResolution(myImage.HorizontalResolution, myImage.VerticalResolution); using (var g = Graphics.FromImage(b)) { g.Clear(Color.White); g.DrawImageUnscaled(myImage, 0, 0); } // Now save b as a JPEG like you normally would }
geom_rect and alpha – does this work with hard coded values?
This was puzzling to me, so I went to google, and ended up learning something new (after working around some vagaries in their examples). Apparently what you are doing is drawing many rectangles on top of each other, effectively nullifying the semi-transparency you want. So, the only ways to overcome this are to hard-code the … Read more
Setting alpha on UIView sets the alpha on its subviews which should not happen
I think this is a bug in the documentation. You should file it at bugreport.apple.com. Everything I can see after a bit of quick research suggests what you are seeing is how it always has behaved, and my own testing shows it too. The alpha of a view is applied to all subviews. Perhaps all … Read more
Set transparent background using ImageMagick and commandline prompt
I am using ImageMagick 6.6.9-7 on Ubuntu 12.04. What worked for me was the following: convert test.png -transparent white transparent.png That changed all the white in the test.png to transparent.
Replace transparency in PNG images with white background
-background white -alpha remove -alpha off Example: convert image.png -background white -alpha remove -alpha off white.png Feel free to replace white with any other color you want. Imagemagick documentation says this about the -alpha remove operation: This operation is simple and fast, and does the job without needing any extra memory use, or other side … Read more