Transparent background of HEIC image is black - android-studio

I am changing a PNG image with a transparent background to HEIC format. I want to display the modified image using Android Studio's ImageView. To use the HEIC file I used an asset folder and an ImageDecoder.
However, the transparent background of the HEIC turned black.
I converted png to heic on various sites and exported it using mac preview app, but I couldn't stop the background from turning black. I would appreciate it if you solved.
here's my code:
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="287dp"
android:layout_height="557.5dp"
android:layout_marginStart="1.8dp"
android:background="#android:color/transparent"
android:id="#+id/main_character"
android:layout_alignParentBottom="true"/>
val drawable1 = ImageDecoder.decodeDrawable(ImageDecoder.createSource(contextRepo.getValue("main").assets,"anna_character.heic"))
main_character.background = drawable1

Related

Issue with color profile of CMYK image

The issue
I'm chasing a color issue that occurs during a gm convert of a jpg in CMYK colorspace to png. Just when I thought I'd isolated the issue and wanted to upload the images I realized that my issue has none to do with GraphicsMagick as the upload preview already showed the issue on the source image.
The source image
The majority of image tools (including XnView, browser) renders it light green.
Some image tools (including Faststone Image Viewer) render this image with dark green color:
To persist the issue
Running gm convert isolated-in.jpg png:isolated-out.png persists this light green for all image renderes.
The desired outcome
The dark green color is the desired outcome. I understand that there must be a corruption of the color profile of the input image. Infact, there seems to be none. However, some image tools render it correctly, making me beliefe there is a differet "guess" on the profile. What are those image tools doing so that it appears dark green? And, can I, with gm identify and/or gm convert correct for the missing/corrupted color profile of the source and persist the correct color, which is dark green?

why does gnome automatically fills the symbolic icons in files

I try to design some icons for gnome (symbolic icons) but the problem is that gnome files make them completely black(it fills the transparent areas in the icons)
how i can solve this problem
Use SVG or PNG for the image file of the icon.
https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
Some other image formats don't support transparent white space. I recommend testing your icons in an image viewer that supports white space. If you get a similar effect, mind this is not in the editing program so what your seeing in the image decoding library making sense of the image, then you should try to change image format to a different format that supports transparent white space. If you are using Gnome, Eye of Gnome, the default image viewer, should show a gray checkered pattern where there is white space.

Transparent GIF image not transparent in web, has background

the img I made is suposed to be transparent but when I upload it to my web page it has a dark blueish background, just don't understand why .. please help, how can I check if its fully transparent ?
what browser? transparency in gif is just a color that you set as transparent and the browser must interpret it as transparent. Some older browsers don't work with it. If it displays correctly in any modern browser such as chrome for example, then the transparency is correctly set in your gif.
You can try another different software to save the GIF or a different method of selecting transparency, for example, by mask instead of by color. Or try a PNG format instead.

converting rgb image to gray image in vc++ using opencv

i created gui application in vc++2010 express, i loaded image folder to list box and by selecting listbox item the image is displaying in picturebox1, using browse button.
Now i want to access the picturebox1 image and convert to gray scale image and converted grey scale must be displayed in picturebox2, using grey convert button. plzz help me frnds
thanq
karuna
Get the image in opencv Mat. Then use cvtColor function to convert the image. CV_BGR2GRAY code is used to convert from RGB to grayscale. Then show the grayscale image back to wherever you want to display it.

How to display a .bmp in an NSImageView for MacOs so that a certain color is transparent?

I have some .bmp files that have some color (maybe black) that is supposed to show as transparent when the graphic is displayed on top a form, so the form color comes through the transparent areas. But by default, when I put these images in an Image View, the black/transparent areas show up as BLACK!
I'm thinking I need to either:
- alter how the NSImageView shows the image, so that a certain color is transparent, or
- modify the .bmp files somehow to make that color suitable for transparency in an NSImageView
But I don't know enough about graphics files, transparency(alpha), NSImageView, nor the image editing tools. I'm trying to use Gimp, but...not sure what I'm doing yet. It seems like there is already a color that should be transparent in the current .bmp file.
I'm sure its something simple for setting NSImageView, or editing my file, or perhaps making a mask for the image, but I don't know how yet. I've looked at various filters in IB for NSImageView, but have not found where to set the transparent color, nor how to grab that color from the image file to make sure I use the correct value.
Thanks in advance for any assistance. (I tried to post some images, but because I'm new, I could not.)
Beau
I'm not a Cocoa developer, but in Gimp try adding an alpha channel to your image (a layer mask, perhaps) then saving as a 32-bit PNG image (with an alpha channel), then load that PNG directly into your NSImageView. If you want to make the black pixels transparent in Gimp use the magic-wand tool to select them (use magic-wand with 0 tolerance) and just delete the contents of the selection then save as a PNG directly.

Resources