alpha-transparency

Need help understanding Alpha Channels

人走茶凉 提交于 2019-12-24 17:15:09
问题 I have the RGB tuple of a pixel we'll call P. (255, 0, 0) is the color of P with the alpha channel at 1.0. With the alpha channel at 0.8, P's color becomes (255, 51, 51). How can I get the color of the pixel that is influencing P's color? 回答1: Let's start from the beginning. A pixel with alpha only makes sense when it is blended with something else. If you have an upper layer U with alpha and a lower layer L that is totally opaque, the equation is: P = (alpha * U) + ((1.0 - alpha) * L)

How to scale a Graphics2D image with transparent padding

家住魔仙堡 提交于 2019-12-23 18:04:20
问题 I'm trying to write a small method which takes a BufferedImage image and a new width and height and scales the image keeping the aspect ratio by adding transparent border to the left/right or top/bottom depending on the image. The scaling works fine but for the life of me I can't get the border to be transparent. So far I have the following code posted on pastebin.com which does the scaling well. I've read a lot of manuals and other SO questions to no avail. I've tried numerous permutations

calculate RGB equivalent of base colors with alpha of 0.5 over white background in matplotlib

陌路散爱 提交于 2019-12-22 10:33:55
问题 I would like to be able to replicate the look of a primary color ('r','g' or 'b') in matplotlib with an alpha of 0.5 over a white background, while keeping the alpha at 1. Here is an example below, where through manual experimentation I've found the RGB values that with an alpha of 1, look similar to matplotlib default colors with an alpha 0.5. I was wondering if someone had an automated way of achieving this. import matplotlib.pyplot as plt s=1000 plt.xlim([4,8]) plt.ylim([0,10]) red=(1,0.55

unable to transparent pixels of a bitmap image

南楼画角 提交于 2019-12-22 10:03:53
问题 I am working with bitmap images whose transparent parts are colored in magenta (in some languages it is possible to set a color as transparent). I try to transparent pixels which are in magenta in the original bitmap image. I load the bitmap from SD-card: Bitmap bitmap = BitmapFactory.decodeFile(myImagePath); copy it to another bitmap to make it mutable: Bitmap bitmap2 = bitmap.copy(Bitmap.Config.ARGB_8888,true); Then scan it pixel by pixel to find pixels in magenta and try to change their

How to convert this indexed PNG to grayscale and keep transparency, using Python and Pillow?

风格不统一 提交于 2019-12-21 22:47:21
问题 I am trying to convert images to grayscale using Python/Pillow. I had no difficulty in most images, but then, while testing with different images, I found this logo from the BeeWare project, that I know that has been further edited with some image editor and recompressed using ImageOptim. The image has some kind of transparency (in the whole white area around the bee), but black color gets messed up. Here is the code: #/usr/bin/env python3 import os from PIL import Image, ImageFile src_path =

Why does System.Drawing.Graphics blank the RGB channels when Alpha==0?

烂漫一生 提交于 2019-12-21 19:46:51
问题 This has become a serious blocker for a program I'm working on to manipulate images that have Alpha channels. Many of the images I have contain color information where an Alpha channel is completely transparent, and yet as soon as I try to load them into System.Drawing.Graphics, it changes anything with of Alpha of 0, into Black with an Alpha of 0. Here is a basic sample of the issue. I have looked around trying to find a reason, answer, or workaround, but I haven't found anything that even

Semi-transparency in RStudio

混江龙づ霸主 提交于 2019-12-21 03:49:41
问题 I'm trying to create a plot with a semi-transparent confidence region around the regression line: library(car) library(ggplot2) library(effects) mod <- lm(salary~yrs.service+sex, data=Salaries) yrseff <- as.data.frame(allEffects(mod)[[1]]) ggplot(yrseff, aes(x=yrs.service, y=fit))+ geom_ribbon(aes(ymin=lower, ymax=upper), alpha=.2)+ geom_line(colour="darkgreen", size=2) I get this error message: Warning message: In grid.Call.graphics(L_polygon, x$x, x$y, index) : semi-transparency is not

openCV: adding transparency to IplImage

≡放荡痞女 提交于 2019-12-19 04:11:07
问题 I have a 3-channel IplImage. I would like to create a 4-channel image and set the alpha channel for it to a value less than 1.0 to make it semi-transparent. First I set the alpha channel (the 4-th channel) to 0.5: cvSet(Image_c4, cvScalar(0,0,0,0.5); Here is the command that I used to copy the 3-channel image into a 4-channel image. cvCvtColor(Image_c3, Image_c4, CV_RGB2RGBA); The problem: Image_c3 is in color. Image_c4 becomes a gray scale copy of Image_c3 (and with no transparency). Update

How to make alpha transparent TImage in Delphi?

落爺英雄遲暮 提交于 2019-12-18 17:12:25
问题 On the Form I have two TImages. TImage which is on the top should be transparent, so we can see what is underneath. How to change the level of TImage transparency? Example: 回答1: The usual way would be drawing all graphics to one destination canvas (which could be the bitmap of an TImage), but even with many overlapping TImages this can be done. Be aware that you can't overlap TWinControls. Since a 32 bit Bitmap support transparency this can be reached by converting the contained graphic to an

How to make alpha transparent TImage in Delphi?

穿精又带淫゛_ 提交于 2019-12-18 17:12:22
问题 On the Form I have two TImages. TImage which is on the top should be transparent, so we can see what is underneath. How to change the level of TImage transparency? Example: 回答1: The usual way would be drawing all graphics to one destination canvas (which could be the bitmap of an TImage), but even with many overlapping TImages this can be done. Be aware that you can't overlap TWinControls. Since a 32 bit Bitmap support transparency this can be reached by converting the contained graphic to an