Loading...

How to erase a part of a picture ?

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

How to erase a part of a picture ?

Postby louis » Tue Jun 30, 2009 8:32 pm

Hi,
I would like to replace a part of the picture to a transparent part, without anything.
Is it needed to use DrawImageTransparency ?
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: How to erase a part of a picture ?

Postby Loïc » Wed Jul 01, 2009 7:31 pm

Hi,

Here a sample to make an area of an image transparent:

Code: Select all
Call Imaging1.SetROI(10, 10, 100, 100)
Call Imaging1.SwapColorEx(0, 0, 0)


Let me know if it is not clear enough.

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

Solved : SetROI parameters must be right

Postby louis » Thu Jul 02, 2009 3:40 pm

The height and width values in SetROI were too large, so that nothing is done in that case.

Could you explain why SwapColorEx 0,0,0 (0 as source color, 0 as target color and 0 as threshold) produces transparency ?
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: How to erase a part of a picture ?

Postby Loïc » Thu Jul 02, 2009 9:59 pm

Hi,

The height and width values in SetROI were too large, so that nothing is done in that case.


Of course, I was unable to guess the region you have to process. I gave you a sample of a rectangle with 100 pixels of with & height starting at coordinate (10, 10). Just change these parameters to do what you want...

Code: Select all
Could you explain why SwapColorEx 0,0,0 (0 as source color, 0 as target color and 0 as threshold) produces transparency ?


0 is the black color with full transparency (or ARGB(0,0,0,0)).
In the sample I simply asked to replace all pixel into the ROI by the color ARGB(0,0,0,0).

Kind 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 erase a part of a picture ?

Postby louis » Tue Jul 07, 2009 11:50 am

The "problem" was solved (mentioned in the subject). I just said that we have to put values not greater than the width/heigth. In my example, I erase a part up to the right. So, it is necessary to enter the width instead of a greater value. So, no problem ! That's fully Ok.
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

How to change white backcolor to transparency ?

Postby louis » Wed Jul 08, 2009 1:54 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


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest

cron