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 : Sunday, July 22, 2007 4:53:03 PM(UTC)

Rajakri  
Rajakri

Groups: Registered
Posts: 8


Hi All,
I am trying the sample code and not getting correct output.The output from the example code is all black .Can anyone throw some light what is wrong with the sample code or give me the correct example code.
Jpeg1 and Jpeg2 is just images with black background why ?
Please response asap since i am running out of time to finish this work.

-------------------------------------------------
Public Sub CodecsJpegOptionsExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()

Dim srcFileName As String = "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Slave.jpg"

' Get all Information about the Jpeg file that you want to load.
Dim imageInfo As CodecsImageInfo = codecs.GetInformation(srcFileName, True)

'Setting Jpeg Load options.
codecs.Options.Jpeg.Load.DisableMmx = False
codecs.Options.Jpeg.Load.DisableP3 = False
codecs.Options.Jpeg.Load.ForceCieLab = True
codecs.Options.Jpeg.Load.ForceRgbFile = False
codecs.Options.Jpeg.Load.UseBadJpegPredictor = False

Dim srcImage As RasterImage = codecs.Load(srcFileName)

'if the image has stamp then set the Jpeg settings related to the stamp.
If imageInfo.Jpeg.HasStamp Then
codecs.Options.Jpeg.Save.FixedPaletteStamp = True
codecs.Options.Jpeg.Save.JpegStamp = True
codecs.Options.Jpeg.Save.SaveWithoutTimestamp = False
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 = False
End If

If imageInfo.Jpeg.IsLossless Then
Console.WriteLine("This is a lossless Jpeg Image")
Else
Console.WriteLine("This is not a lossless Jpeg Image")
End If

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

codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = CodecsCmpQualityFactorPredefined.Custom
codecs.Options.Jpeg.Save.DisableMmx = True
codecs.Options.Jpeg.Save.DisableP3 = True
codecs.Options.Jpeg.Save.QualityFactor = 2
codecs.Options.Jpeg.Save.SaveOldJtif = True

codecs.Save(srcImage, "C:\Program Files\LEAD Technologies\LEADTOOLS EVAL 15\Images\jpeg1.jpg", RasterImageFormat.Jpeg, srcImage.BitsPerPixel)

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 = 75
codecs.Options.Jpeg.Save.StampWidth = 50
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

codecs.Save(srcImage, "C:\Program Files\LEAD Technologies\LEADTOOLS EVAL 15\Images\jpeg2.jpg", RasterImageFormat.Jpeg, srcImage.BitsPerPixel)

' Clean up
srcImage.Dispose()
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub
------------------------------------------------
This will allow me to speed up the purchase of Leadtools .
Thanks & regards
 

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 : Monday, July 23, 2007 12:23:47 PM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


The problem is that you have set codecs.Options.Jpeg.Load.ForceCieLab = True.  If you read the documentation on this property, you will see that this causes the RasterCodecs object to expect that the image data is of the CIELAB colorspace.  In the case of the image you loaded, it is NOT that colorspace and therefore the data turns out black.
 
#3 Posted : Monday, July 23, 2007 7:48:39 PM(UTC)

Rajakri  
Rajakri

Groups: Registered
Posts: 8


Thanks Greg.
I got this issue resolved.
 
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.141 seconds.