Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Combine two images (Mask, Transparency)
Started by brunopacola at 08-21-2007 0:50. Topic has 2 replies.

Print Search « Previous Thread Next Thread »
  08-21-2007, 0:50
brunopacola is not online. Last active: 2/19/2008 1:09:33 PM brunopacola

Not Ranked
Joined on 05-08-2007
Posts 5
Combine two images (Mask, Transparency)
Reply Quote
Hi,

I need insert a MASK PNG TRANSPARENCY but the color that wrong!

Example:

Original image:
http://www.mtfazendas.com.br/Diversos/ImageOriginal.jpg

Image PNG:
http://www.mtfazendas.com.br/Diversos/MarcaMTFazendas.png

Image Correct:
http://www.mtfazendas.com.br/Diversos/ImageCorrect.jpg

BUT LEADTOOLS....

Image INCorrect:
http://www.mtfazendas.com.br/Diversos/ImageINCorrect.jpg


CODE USED:



                RasterCodecs.Startup()
                Dim codecs As RasterCodecs = New RasterCodecs()

                Dim srcFileName As String = CaminhoOrigem & "\" & arqOrigem.Name '"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Slave.jpg"

                Dim imageInfo As CodecsImageInfo = codecs.GetInformation(srcFileName, True)


                codecs.Options.Jpeg.Load.DisableMmx = False
                codecs.Options.Jpeg.Load.DisableP3 = False
                codecs.Options.Jpeg.Load.ForceRgbFile = False
                codecs.Options.Jpeg.Load.UseBadJpegPredictor = False

                Dim srcImage As RasterImage = codecs.Load(srcFileName)

                If imageInfo.Jpeg.IsProgressive Then
                    codecs.Options.Jpeg.Save.Passes = 0
                End If


                codecs.Options.Jpeg.Save.FixedPaletteStamp = False
                codecs.Options.Jpeg.Save.JpegStamp = True
                codecs.Options.Jpeg.Save.SaveWithoutTimestamp = True
                codecs.Options.Jpeg.Save.SaveWithStamp = True
                codecs.Options.Jpeg.Save.StampBitsPerPixel = srcImage.BitsPerPixel
                codecs.Options.Jpeg.Save.StampHeight = 100
                codecs.Options.Jpeg.Save.StampWidth = 100
                codecs.Options.Jpeg.Save.YccStamp = True
                codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = CodecsCmpQualityFactorPredefined.MaximumQuality
                codecs.Options.Jpeg.Save.DisableMmx = False
                codecs.Options.Jpeg.Save.DisableP3 = False
                codecs.Options.Jpeg.Save.SaveOldJtif = False


                Dim ComandoImagem As Leadtools.ImageProcessing.SizeCommand = New Leadtools.ImageProcessing.SizeCommand

                ComandoImagem.Flags = Leadtools.RasterSizeFlags.Bicubic
                ComandoImagem.Width = 398
                ComandoImagem.Height = 299
                ComandoImagem.Run(srcImage)


                Dim srcImageMarca As RasterImage = codecs.Load("C:\Documents and Settings\Pacola\Meus documentos\MarcaMTFazendas.png")
                Dim command As CombineCommand = New CombineCommand

                command.SourceImage = srcImageMarca.Clone()
                command.DestinationRectangle = New System.Drawing.Rectangle(182, 265, 398, 299)
                command.SourcePoint = New System.Drawing.Point(0, 0)
                command.Flags = CombineCommandFlags.SourceNop
                command.Run(srcImage)
                codecs.Save(srcImage, CaminhoDestino & "\gde\TEST" & QuantidadeFotosStr & arqOrigem.Extension, RasterImageFormat.Jpeg, srcImage.BitsPerPixel)



Thanks,





   Report 
  08-21-2007, 13:48
brunopacola is not online. Last active: 2/19/2008 1:09:33 PM brunopacola

Not Ranked
Joined on 05-08-2007
Posts 5
Re: Combine two images (Mask, Transparency)
Reply Quote
I'm trying...

Code example:


Public Sub FeatherAlphaBlendCommandExample()
   RasterCodecs.Startup()
   
Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages =
True

   
Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg")

   
Dim command As FeatherAlphaBlendCommand = New FeatherAlphaBlendCommand
   command.DestinationRectangle =
New Rectangle(0, 0, leadImage.Width \ 2, leadImage.Height \ 2)
   command.MaskImage = codecs.Load(
"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image3.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1)
   command.SourceImage = codecs.Load(
"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Image2.cmp", 24, CodecsLoadByteOrder.Bgr, 1, 1)
   command.SourcePoint =
New Point(0, 0)
   command.Run(leadImage)
   codecs.Save(leadImage,
"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Result.jpg", RasterImageFormat.Jpeg, 24)

   command.SourceImage.Dispose()

   RasterCodecs.Shutdown()
End Sub

But..message error:

"Leadtools Pro features are not enabled"



   Report 
  08-23-2007, 10:52
Qasem Lubani is not online. Last active: 12/21/2008 9:12:09 PM Qasem Lubani



Top 10 Posts
Joined on 08-13-2006
Posts 1,187
Re: Combine two images (Mask, Transparency)
Reply Quote

The error message that you are getting is due to the Raster pro capabilities being locked. You need to use the Unlock method to unlock the pro capabilities.

 

The unlock key is located in the following directory [LEADTOOLS 15\Include\Ltkey.h] of your LEADTOOLS installation.

 

If you face any problems, please send your serial number to support@leadtools.com
Qasem Al-Lubani
LEAD Technical Support
www.leadtools.com
   Report 
Post
LEAD Support Fo... » Developer » DotNet » Combine two images (Mask, Transparency)

Powered by Community Server, by Telligent Systems