This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, April 19, 2006 7:16:27 AM(UTC)
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!
#2
Posted
:
Thursday, April 20, 2006 10:09:17 AM(UTC)
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.
#3
Posted
:
Friday, April 21, 2006 7:14:31 AM(UTC)
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)
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.
#5
Posted
:
Monday, April 24, 2006 5:56:32 AM(UTC)
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.