Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, April 19, 2006 7:16:27 AM(UTC)
catcream

Groups: Registered
Posts: 5


Hi, I am working on a project in which I need to convert multi-color images into 2-color(white and one other color depending on customers' choice) images and then save them as gifs with transparent background. I am able to convert the files to 2-color, but don't know how to change the white color to transparent when saving the image files. Can anyone tell me how to do this? Thanks!
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, April 20, 2006 10:09:17 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

This depends on the programming interface you're using. For example, if
you use the DLL API, you need to set BITMAPHANDLE.Flags.Transparency to TRUE and the desired color in BITMAPHANDLE.Transparency.


When using the OCX/COM, you need to set the BitmapTransparentColor
property to the color while setting the BitmapEnableTransparency property to TRUE.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#3 Posted : Friday, April 21, 2006 7:14:31 AM(UTC)
catcream

Groups: Registered
Posts: 5


I am using COM and vb script. The following is a snippet of code to save the file, but the image saved is still with white background. <br>
<br>
<br>
RasterProc.UserPalette(0) = RGB(Red, Green, Blue)
'Red, Green, Blue are variables defined before<br>
RasterProc.UserPalette(1) = RGB(255, 255, 255)<br>
RasterProc.ColorRes Raster, 1, 16, CRD_STEVENSONARCEDITHERING, 2<br>
Raster.BitmapTransparentColor = RasterProc.UserPalette(1) <br>Raster.BitmapEnableTransparency = True<br>
myFileName ="test.gif"<br>
result = RasterIO.Save (Raster, myFileName, 10, 24, 2, SAVE_OVERWRITE)<br><br>


Any ideas? Thanks!
 
#4 Posted : Monday, April 24, 2006 1:01:21 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Your code is mostly correct, but the file format you are saving is JPEG, not GIF.
The value of FILE_GIF is 2, not 10. What your code saves is actually FILE_JPEG (10).
Also, GIF can have a maximum bits per pixel value of 8, not 24. In your case you should use 1 because you only have 2 colors.

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#5 Posted : Monday, April 24, 2006 5:56:32 AM(UTC)
catcream

Groups: Registered
Posts: 5


It worked! Super! Thanks a loooooooooooooooooooot!
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.124 seconds.