LEADTOOLS Support
Imaging
Imaging SDK Questions
Re: Saving transparent GIF/PNG etc into transparent ICON
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Sunday, September 17, 2006 2:51:21 PM(UTC)
Groups: Registered
Posts: 7
Hi,
I am using LeadTools Raster Imaging v14.0 Toolkit with latest v14 patch, with Visual Studio 2005 using C++ MFC.
I am making an image converter software, but having some problems converting a transparent GIF image into a transparent ICON. After loading the image, I check the BitmapTransparentColor and BitmapEnableTransparent of the opened image and they return true and the correct transparent color, so the saved image should contain those values aswell. It all results in when saving the icon having black/red etc background (depending on the background color that's supposed to be the transparent color).
The same thing happens if you use the included "01 MFC Main Demo" of the Raster Imaging Toolkit and open a transparent GIF file, resize it to e.g. 32x32 (as required by the icon format) and then save it as an icon. In the Main Demo program, it shows the GIF file correctly with the transparent color, but the saved icon doesn't have a transparent color.
Thanks for your help!
#2
Posted
:
Tuesday, September 19, 2006 12:45:00 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
To save a transparent Windows ICON, you need to define a region in the LEADTOOLS bitmap, then save the bitmap as Windows Icon using our LEADTOOLS Save functions. You can try this using the Main C++ ClassLib demo.
Please let me know if this helps.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Tuesday, September 19, 2006 4:02:33 AM(UTC)
Groups: Registered
Posts: 7
Hi,
Thanks for your reply.
By defining a region, do you mean I need to define a region of where the transparency is and then set some color in that region, or just define a region of the whole bitmap and save the bitmap? I'm pretty new to Leadtools Raster and haven't used any region functions yet.
#4
Posted
:
Tuesday, September 19, 2006 10:35:42 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
You need to set a region to the area that you want show in the ICON image when you save it.
For example, if you have an image with a Black background and you want to set the black as transparent in the result ICON file, the region area should not contain the Black background. You can use the LBitmapRgn::SetRgnColor to add the region that consists of all the pixels of a specified color (Black RGB(0,0,0)) and you need to set the LBitmapRgn::SetRgnCombineMode to L_RGN_SETNOT.
For more information, please refer to the LEADTOOLS Class Library Help file and read the following topics:
- LBitmapRgn::SetRgnColor
- LBitmapRgn::SetRgnCombineMode
- Creating a Bitmap Region.
Please let me know if this helps.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#5
Posted
:
Wednesday, September 20, 2006 5:31:33 AM(UTC)
Groups: Registered
Posts: 7
Awesome! It works! :)
Thanks a lot!
LEADTOOLS Support
Imaging
Imaging SDK Questions
Re: Saving transparent GIF/PNG etc into transparent ICON
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.