I found JPG does not support transparency, the alpha value is always 255. I am wondering only png supports transparency?
png-32 supports different levels of transparency. Each pixel can have an opacity between 0 and 255, with 0 as completely transparent.
png-24 supports setting one color as fully transparent. Everything else will be opaque.
gif uses a color palette. You can specify that one color in the palette is fully transparent.
png-8 also uses a color palette but each color in the palette has its own opacity value, so it supports varying levels of transparency too.
jpg does not support transparency.
JPEG 2000 supports full transparency. See JPEG 2000 Side channel spatial information.
JPEG XR (not the same as JPEG 2000) also supports transparency.
However it is not a useful format for the web as only Internet Explorer and Edge support it.
WebP is another emerging image format with support for transparency.
However, Internet Explorer lacks support for it.
From Transparency (graphic) - Wikipedia:
Raster file formats that support transparency include GIF, PNG, BMP, TIFF, TGA and JPEG 2000, through either a transparent color or an alpha channel.
Related
These 2 images both have the same PNG extension, both have the sRGB color profile embedded in them, and the background is for both #f14505. However in Firefox they are shown in 2 different shades of red.
Needed to remove gamma correction with pngcrush
pngcrush -rem gAMA input.png output.png
I have image of object with transparent background for my Flutter app.
But Flutter shows this image with transparent background, as it is.
How do i hide transparent background of the image in Flutter?
The image you are using is not a proper transparent PNG file. It's a JPEG. So, please use a proper transparent PNG file. Here are some difference between a JPEG and PNG:
Both support true color or a palette of 16 million colors, PNG also
supports 256 color and monochrome images.
JPEG uses a lossy algorithm, PNG uses the ubiquitous lossless
algorithm which we all know as ZIP.
PNG supports alpha as well as single color transparency. JPEGS are
opaque.
Compression ratio of images can be upto 50x for a JPEG but maybe at
most 4:1 in PNGs for most images with many colors
Am converting 32 bpp bitmap to 8bpp with 256 color pallete, this image i want to encode using h264 and send it over socket. And on the other end decode the frame and display it on my UI.
From Encoder, side:
Capture 32 bpp image.
Quantize the image to 8bpp with 256 color pallete.
Sws_scale the image from PIX_FMT_GRAY8 to YUV420P.
Encode it with h264 and send it over socket.
From Decoder, side.
Receive image.
Decode image.
Sws_scale from YUV420P to PIX_FMT_GRAY8
And display it on UI along with palette information(Sent from Encoder over socket).
When the above steps are followed, i get a totally distorted image. And when i dont use the color palette i get a black and white image.
Am not not clear how to encode the 8bpp 256 palette bitmaps using h264 and decode them accordingly. Please help me regarding this.
Am working with C++ on windows platform.
Thanks in advance,
Paul.
h.264 is not (by default) a lossless codec. So you will not get the exact color out that you put in on a pixel by pixel basis. In YUV the Y plan is luminance (black and white) and the UV planes are chroma. So your UV planes are empty here. The Y plane is compressed in a lossy fashion. so you may have a pallet that looks like 0=black 1=red 2=green ... 255=white. And you put in a 2 pixel. During the compression, to remove complexity in the image to reduce file size, the 2 may become a 1. In a black and white image you will not notice the difference. But when you apply your pallet, you green pixel just turned red.
You either need to use a a lossless codec, or encode your 256 color image to a YUV color image. Then post decode re-qunatize the colors back to your desired pallet by finding the closest color or each decoded pixel.
I am on MAC OSX.
How to convert an gray scaled image to the RGB format.
Can i use the CIFilters for converting? Or any other way
And also i want to reverse the operation. i.e., convert the RGB format to Gray scaled format.
Regards,
Dhanaraj.
You can draw the grayscale image into an RGB-color context and export that image. Of course, the ability to draw a grayscale image into a non-grayscale context means you probably don't need to convert the image in the first place, since it will be done for you on-the-fly.
Core Image requires RGB images as input and produces them as output. I think it will convert a non-RGB image for you, so you could just use some simple filter in its identity configuration, but that's unnecessary.
What are you really trying to do that requires you to convert the image?
Is there any software, plugin or technique that would allow creating/exporting PNG-like GIFs with smooth transparent edges, at least for smaller images like bullets or buttons.
I really have to use GIFs sometimes for IE6 so it'd would be great to know if such a tool exists?
Thanks
No, the GIF format does not support alpha-channel transparency like PNG does. You can only select one out of the 256 possible colors in a GIF to be transparent.
If you know roughly what color the background will be, the best you can do is create the GIF with the same background you plan to use it on, then select the background color as transparent. The smooth edges will look smooth against that specific background, but horrible against other colors.
The edges in a PNG are smooth because of anti-aliasing, and thus, variable opacity. The GIF format doesn't support this, so unfortunately no there isn't a way to do it.
GIF doesn't have an alpha channel like PNG, so you can't get smooth transparent edges. The alpha channel specifies how transparent each pixel is, so you could have half-transparent pixels for example. GIF on the other hand is limited to 8 bit colors and one of them is designated as the transparent color.
yes, a GIF can be transparent, just use png transparent frames and when embedded in css it would have a transparent background.
background: url(../images/mundog.gif) no-repeat;
As far as I recall (I've not used GIFs for quite some time), a GIF doesn't have a variable transparency - a pixel is either transparent or not.
You could simulate transparency by blending with the background image, but that would rely on having a static, defined background.
The modern solution for this is using WebP instead of GIF.
WebP supports both animation and an alpha channel, as well as lossless compression.
It's well-suported by browsers nowadays.