The default background is white. I am wondering if it is possible to set it to transparent. So I can use the other control(a video player, for example) as a background. The cefsharp is only used to display some text.
I am using cefSharp.WinForms, Version=71.0.0.0
Related
I have designed a set of icons in B&W designed to be used on a white background so they are antialiased with different gray pixels. They are very nice so now I would like to use them on a green background but I am not able to "correct" the antialias for the green background. I am quite familiar using paint.net and gimp so I would like to learn how "correct" my icons using one of them.
This is 2022...
In the previous millennium all we had was GIF where pixels were completely opaque or completely transparent, while real edge anti-aliasing requires partial opacity. So you would typically create the image normally with partially opaque anti-aliasing pixels, and then "semi-flatten" it by replacing these partially opaque pixels with fully opaque ones holding the adequate color blend between the object and the intended background. But with modern image formats (PNG and WebP) that support partial opacity this is no longer needed
So:
Open your icon image in Gimp
Make sure it is in RGB mode (Image > Mode > RGB)
Set the Bucket-fill tool to Color erase mode
Bucket-fill the image with the color used for the semi-flattening (white, in your case). Your "gray" pixels should be replaced with the equivalent partially opaque pixels.
So this:
Becomes this:
At that point, if you export your image as a PNG it will be anti-aliased for any background color (and gradients, and patterns...).
If you insist in doing it the old way, you can still use Layer > Transparency > Semi-flatten on that universal image to make sure your image only works on one background:
Google Chrome always seems to be changing the color of an image that I'm trying to match to a background color. I tried saving it in Photoshop and GIMP and even adjusted the color settings in each but it doesn't help in Chrome. FF and IE work fine (for once).
The color of my image is #282828. After I saved it as a PNG, I reopened it in both GIMP and Photoshop and used the eyedropper tool to confirm that the color was still #282828. When it renders in Chrome it's darker. I have a div with a background color of #282828, and the image is right next to it. I took a screen shot and the div's background color was #282828 and the images background color was #1d1d1d. I tried this for several different colors and each has had the same result. I even tried making the source image the color Chrome was rendering it as but Chrome still changes it. So for example, since Chrome was changing #282828 to #1d1d1d, I made the source image #1d1d1d, and when I rendered it in Chrome it was not #1d1d1d, but some other darker color.
At this point, I'm looking for either a fix or a programmatic work-around. Because the image is transparent, has curves, and a drop-shadow, there's really no way for me to avoid replacing the it, or even parts of it, with html.
Update:
I also tried saving it as a jpg and gif. gif actually works but can't preserve the drop shadow. The image I'm using is attached. If I take a screenshot of this in Chrome, GIMP's eyedropper tool says it's #1d1d1d. If I open the original and do the same, it's #282828.
PNG uses gamma correction to try to ensure that the image looks kinda the same across all monitors, and this can cause color mismatches like the one you're seeing. It's a combination of image editor issues and browser issues: image editors are not forced to embed gamma data inside images, and browsers are free to ignore the gamma correction if it's there and free to enforce some at random when it's not there. In this case, I'd rather think that Firefox ignores it.
Use a transparent PNG if you don't want its background to interfere with your page's background.
[EDIT] For your specific case, you may be able to replicate the graphics you're looking for by styling elements, using border-radius and box-shadow, two widely-implemented CSS3 properties that reasonably decay on older browsers.
I develop in Visual Studio. When I browse my pages, if, for example, a div has a background set using css to be an image which is, effectively, a graduated tint - it appears in bands of colour - i.e. not graduated.
Is there some setting I can change so IE shows background graduated tints properly?
You can use this site to generate your background color. This site is a css gernerator and it generates code for IE 6-7-8-9 and other browsers.
http://www.colorzilla.com/
I'm looking to see if this is possible and if so how to do it. I want the user to upload an image with a white background. The image can be anything from a pair of shoes to a hat. The website will then automatically turn that white background transparent then store it. What I want to know is there a way using HTML Canvas/CSS to transform that white background to 100% transparency?
You can have a look at this answer, which explains nicely how to change colors in an image using javascript : How to change color of an image using jquery
However, you should do this using server side code, and be aware that results may vary, as just removing a color will not look nice on the edges of your object.
My Widget declares:
setAttribute(Qt::WA_NoSystemBackground);
In its paintEvent, I set:
painter.setOpacity(0.75);
This gives me the ability to project a png on its entire background with some transparency. This works well.
Problem: I am adding a QPushButton with a transparent png on top of my widget. The opaque portion of the button's image (derived from Qt CSS) is shown correctly, and the transparent areas remain with my widgets' drawn background, which is already somewhat transparent. When I HOVER over the image, my css dictates that my QPushButton changes image. When that happens, the opaque portion of the button image is shown correctly, but for the transparent areas, it's as if my own widget is re-drawing the background image, only with full opacity.
This happens only on Windows. On OS X is works fine. I was wondering whether there was a bug in Windows in that respect and if there's a workaround for it.
Turns out that while
setAttribute(Qt::WA_NoSystemBackground);
is good enough for OS X…
On windows you should also add:
setAttribute(Qt::WA_TranslucentBackground);
That took care of it. Problem resolved.