How do you calculate overlapping rgba values?

对着背影说爱祢 提交于 2020-01-14 04:24:07
问题 Let's say I have this: .example { background-color: rgba(0, 0, 0, 0.5); border-color: rgba(0, 0, 0, 0.5); } The background-color and border-color have the same rgba value, but are different colors because the border-color is calculated on top of the background-color. (simple example: http://jsfiddle.net/BBdB3/) What transparency value for the border-color would make it match the background-color? What's the math here? Edit: thanks guys, using rgba(0, 0, 0, 0) or transparency is sufficient for

CSS equivalent for Text Tint

时光怂恿深爱的人放手 提交于 2020-01-12 10:37:26
问题 I'm trying to export files from Adobe InDesign to basic HTML + CSS. A user can select some text and change the text colour. Using the InDesign SDK I can fetch the RGB values for that colour and in the CSS file declare color: rgb(R,G,B) which works perfectly fine. You can also change the text tint value. Upto now I was just taking the tint value, converting it to the range 0-1 and in the CSS putting an entry as color: rgba(R,G,B,Tint) During testing I realized that tint = 0 should actually

RGBA format HEX into RGB format HEX? PHP

时光怂恿深爱的人放手 提交于 2020-01-11 07:56:08
问题 I want to convert back and forth between RGBA-formated HEX colors (like 0xFF0000FF ) and RGB-formated HEX colors (like 0xFF0000 ) in PHP. How can I do this? 回答1: How about these: function rgbaToRgb ($rgba, $blend = 0xFFFFFF) { return (($rgba >> 8)*($rgba & 0xFF)/0xFF) * ($blend / 0xFFFFFF); } function rgbToRgba ($rgb) { return ($rgb << 8) | 0xFF; } $blend in the first is effectively a background color to blend with. Edit: fix due to not enough space in ints ruining RGBA. RGBA is now handled

linear-gradient to transparent bug in latest safari?

一笑奈何 提交于 2020-01-09 10:48:29
问题 I'm applying a basic linear-gradient like this: background-image: linear-gradient(to top, red, rgba(0,0,0,0)); this behaves as it's supposed to everywhere except in safari where the transparent is rendered as a blackish/greyish color: here's chrome (how it is supposed to be): and here's safari I've tried prefixing it with -webkit- , changing the rgba to rgba(0,0,0,0.001) but it never goes to solid transparent. is this a bug? is there a way to fix this? here's a fiddle https://jsfiddle.net


人走茶凉 提交于 2020-01-02 10:32:13
问题 I've a simple question: If I'm not going to use Alpha on RGBA, for some colors, should I use HEX on these colors? Is there something HEX has that RGBA doesn't? Like browser compatibility, for example? Or is it just fine to use RGBA all the time? I find it better, cause if I would want to use Alpha, I could. Thanks in advance. 回答1: Both should be compatible with any standards-compliant browser. Edit: There might be some buggy behavior in IE (suprise!): http://css-tricks.com/ie-background-rgb

Load RGBA bitmap with PIL

╄→尐↘猪︶ㄣ 提交于 2020-01-01 05:24:06
问题 I tried to convert a 32-bit Bitmap to 32-bit PNG using PIL. from PIL import Image im = Image.open('example.bmp') print im.mode # it prints 'RGB', but expected was 'RGBA' im.save('output.png', format='PNG') The expected image mode is 'RGBA', but actually i get 'RGB'. I also tried the following code, but it does not work. from PIL import Image im = Image.open('example.bmp') im = im.convert('RGBA') im.save('output.png', format='PNG') 回答1: Ok, here is something to get started. Since I don't know

rawvideo and rgb32 values passed to FFmpeg

怎甘沉沦 提交于 2020-01-01 04:26:07
问题 I'm converting a file to PNG format using this call: ffmpeg.exe -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s <width>x<height> -i infile -f image2 -vcodec png out.png I want to use a converter that can be linked or compiled into a closed-source commercial product, unlike FFmpeg , so I need to understand the format of the input file I'm passing in. So, what does rawvideo mean to FFmpeg ? Is FFmpeg determining what type of raw format the input file has, or does rawvideo denote

CSS RGBA border / background alpha double

北城以北 提交于 2019-12-29 19:51:04
问题 I'm working on a website that has a lot of transparency involved, and I thought I would try to build it entirely in RGBA and then do fallbacks for IE. I need a "facebox" style border effect, where the outer border is rounded and is less opaque than the background of the box it surrounds. The last example from http://24ways.org/2009/working-with-rgba-colour seems to suggest that it's possible, but I can't seem to get it to work. When I try the following: <!DOCTYPE html PUBLIC "-//W3C//DTD

ARGB int array to CMYKA byte array convertion

旧街凉风 提交于 2019-12-25 01:07:19
问题 In this question: Convert RGB to CMYK, I got a way to convert RGB int array to CMYK byte array. Now I hope to convert ARGB int array to CMYKA byte array directly instead of working with the resulting CMYK array and adding the extra alpha channel afterwards. Is it possible? I tried to use 4 bands offset to create the raster like this: WritableRaster raster = Raster.createPackedRaster(db, imageWidth, imageHeight, imageWidth, new int[]{0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000}, null); But

Change color rgba Javascript

萝らか妹 提交于 2019-12-24 19:08:30
问题 Here is my JS code : UTIF._imgLoaded = function(e) { var page = UTIF.decode(e.target.response)[0], rgba = UTIF.toRGBA8(page), w=page.width, h=page.height; var string = rgba.join(); console.log("rgba : ", rgba); var ind = UTIF._xhrs.indexOf(e.target), img = UTIF._imgs[ind]; UTIF._xhrs.splice(ind,1); UTIF._imgs.splice(ind,1); var cnv = document.createElement("canvas"); cnv.width=w; cnv.height=h; var ctx = cnv.getContext("2d"), imgd = ctx.createImageData(w,h); for(var i=0; i<rgba.length; i++)