Setting transparency
Setting transparency
Hi
I am trying to set the transparency of an image where I want all the white to be transparent so that the background colour of the GdViewer shows through.
I have tried using:
oGdPictureImaging.SetColorKey(ImageID, oGdPictureImaging.ARGB(255,240,240,240),oGdPictureImaging.ARGB(255,255,255,255))
but this just makes all the white go black!
I instead tried to use:
oGdPictureImaging.SetColorRemap(ImageID, arcolor)
using the code example but I got errors.
How can I change the white range of colours on an image to be transparent, or to be a different colour?
I am trying to set the transparency of an image where I want all the white to be transparent so that the background colour of the GdViewer shows through.
I have tried using:
oGdPictureImaging.SetColorKey(ImageID, oGdPictureImaging.ARGB(255,240,240,240),oGdPictureImaging.ARGB(255,255,255,255))
but this just makes all the white go black!
I instead tried to use:
oGdPictureImaging.SetColorRemap(ImageID, arcolor)
using the code example but I got errors.
How can I change the white range of colours on an image to be transparent, or to be a different colour?
Re: Setting transparency
Hello:
Let me know if it is OK.
Kind regards,
Loïc
Code: Select all
Imaging1.ConvertTo32BppPARGB(ImageID)
Call Imaging1.SwapColor(ImageID, Color.White, Color.Transparent, 90)
Kind regards,
Loïc
Re: Setting transparency
Hi Loic
Thanks for the reply. I got a 'Object reference not set to an instance ..' error on the SwapColor method?
Thanks for the reply. I got a 'Object reference not set to an instance ..' error on the SwapColor method?
Re: Setting transparency
How to reproduce the problem ?
Or at least, could you provide more info ?
Or at least, could you provide more info ?
Re: Setting transparency
I use a class for the GdViewer and manipulate the images within the class. All works well. This is part of the code:
p_CurrentImage = oGdPictureImaging.CreateGdPictureImageFromFile(imgPath)
Me.DisplayFromGdPictureImage(p_CurrentImage)
Then I added:
oGdPictureImaging.ConvertTo32BppPARGB(p_CurrentImage)
Call oGdPictureImaging.SwapColor(p_CurrentImage, Color.White, Color.Transparent, 90)
The second line triggers the null object error.
p_CurrentImage = oGdPictureImaging.CreateGdPictureImageFromFile(imgPath)
Me.DisplayFromGdPictureImage(p_CurrentImage)
Then I added:
oGdPictureImaging.ConvertTo32BppPARGB(p_CurrentImage)
Call oGdPictureImaging.SwapColor(p_CurrentImage, Color.White, Color.Transparent, 90)
The second line triggers the null object error.
Re: Setting transparency
Ok, by changing ConvertTo32BppPARGB to ConvertTo32BppARGB it worked!
Why is this?
Thanks
Why is this?
Thanks
Re: Setting transparency
I can't reproduce the problem. Are you using the latest version ?
Re: Setting transparency
It looks like I am not using the very latest version. I will download it and try it.
Most of the images I deal with are grayscale - would that cause the problem with ConvertTo32BppPARGB?
And if the image was already colour, would I have a problem instead with ConvertTo32BppARGB? Is there a way of detecting whether the image is grayscale?
Most of the images I deal with are grayscale - would that cause the problem with ConvertTo32BppPARGB?
And if the image was already colour, would I have a problem instead with ConvertTo32BppARGB? Is there a way of detecting whether the image is grayscale?
Re: Setting transparency
hi Loic
I have just installed the latest version and ConvertTo32BppPARGB works now!
The current version of GdPicture.NET.dll shows as 8.5.0.20.
I thought the latest version was 8.5.19?
I have just installed the latest version and ConvertTo32BppPARGB works now!
The current version of GdPicture.NET.dll shows as 8.5.0.20.
I thought the latest version was 8.5.19?
Who is online
Users browsing this forum: Bing [Bot] and 1 guest