Loading...

How to insert an image with a transparent background ?

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

How to insert an image with a transparent background ?

Postby louis » Mon Aug 03, 2009 4:12 pm

During the creation of a pdf file, I would like to transform the white background color of an image to a transparent background. SwapColorEx 0, 0, 0 produces black background.

Code: Select all
        GDIA.PdfNewPdf(path, "", "", "", "") Then
        GDIA.PdfSetMeasurementUnits (2) ' cm
        ImageA = GDIa.PdfAddImageFromGdPictureImage(GDVA.GetNativeImage)       

        GDIB.CloseNativeImage
        GDIB.SetNativeImage (GDVB.GetNativeImage)       
        GDIB.SwapColorEx 0, 0, 0
        ImageB = GDIB.PdfAddImageFromGdPictureImage(GDIB.GetNativeImage)

        Call GDIA.PdfDrawImage(ImageB, 0, 0, width, height)
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: How to insert an image with a transparent background ?

Postby louis » Mon Aug 03, 2009 7:01 pm

Sorry, the code is :
Code: Select all
        GDIA.PdfNewPdf(path, "", "", "", "") Then
        GDIA.PdfSetMeasurementUnits (2) ' cm

        ImageA = GDIa.PdfAddImageFromGdPictureImage(GDVA.GetNativeImage)       
        Call GDIA.PdfDrawImage(ImageA, 0, 0, widthA, heightA)  ' a 1st image in the PDF

        GDIB.SetNativeImage (GDVB.GetNativeImage)              ' a 2nd image to put on the 1st image
        GDIB.SwapColorEx 0, 0, 0
        ImageB = GDIB.PdfAddImageFromGdPictureImage(GDIB.GetNativeImage)
        Call GDIA.PdfDrawImage(ImageB, 0, 0, widthB, heightB)
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: How to insert an image with a transparent background ?

Postby Loïc » Tue Aug 04, 2009 11:45 pm

Hi,

Transparency in PDF (also called Soft Mask) is not available. We have plans to introduce it but only in a future release of the GdPicture.NET editions.
What I can suggest is to convert transparent pixel to white (background color of the PDF page) to simulate the transparency.

With best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: How to insert an image with a transparent background ?

Postby louis » Wed Aug 05, 2009 1:55 pm

Thanks for the information. We'll be very insterested in the new feature.
In the meantime, we have to try to insert the image in a white homogeneous area in our PDF files.

Louis
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron