Image with transparent background in Flutter - image

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

Related

Why do these 2 images appear with a different shade of red in Firefox, if in Photoshop they look the same and both have the sRGB profile embedded?

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

Only PNG supports transparency, is that true?

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.

crop gif image using libMagick

i am trying to crop a gif image using the libMagick.so library.
./convert --version
Version: ImageMagick 6.2.8 03/31/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
using the following command:
convert img.gif -crop 91x68+6+116 out.gif
the out.gif image gets crop, but not re sized. i get the same image size while all of it is transparent except the 91 pixels starting at 6 pixels from the left point and 68 pixels starting 116 pixels from the top.
how can i make the convert command crop and leave only the cropped part as the output image.
by the way, when my output image is jpg, i get the expected results.
You need to add the -repage option for GIF files:
convert img.gif -crop 91x68+6+116 -repage 0x0 out.gif
The problem is that GIFs can contain multiple images (of different sizes) when they're animated so cropping just affects one of the images while leaving the overall GIF canvas size untouched. Using 0x0 for the canvas size is an easy shortcut to make ImageMagick figure out how big the image should be:
A given a canvas size of zero such as '0x0' forces it to recalculate the canvas size so the image (at its current offset) will appear completely on that canvas.

How to Convert Gray scaled image to RGB image?

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?

How to get better transparency with GIFs?

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.

Resources