(Leadtools 16.net)
The rasterCodecs.Options.Jpeg.Save.StampHeight and width seem to be ignored when saving a rasterimage. Am I doing something wrong? rastercodecs.SaveStamp will save thumbnails other than 160x120 size in .jpg files, but rastercodecs.Save always saves 160x120 thumbnails. Here's a sample of what I'm doing (uses 2 rasterimageviewrs rview1, rview2, and a button).
=======================
Imports System.Drawing
Imports Leadtools
Imports Leadtools.ImageProcessing
Imports Leadtools.Codecs
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim gImage, tImage As RasterImage
Dim fillCmd As New FillCommand
Dim resizeCmd As New ResizeCommand
Dim gCodecs As RasterCodecs
RasterCodecs.Startup()
gCodecs = New RasterCodecs
' gimage is the test image
gImage = New RasterImage(RasterMemoryFlags.Conventional, 400, 800, 24, RasterByteOrder.Bgr, Nothing, Nothing, Nothing, Nothing)
fillCmd.Color = New RasterColor(Color.Aquamarine)
fillCmd.Run(gImage)
' save it with a stamp
gCodecs.Options.Jpeg.Save.StampBitsPerPixel = gImage.BitsPerPixel
gCodecs.Options.Jpeg.Save.StampHeight = 160
gCodecs.Options.Jpeg.Save.StampWidth = 160 * gImage.Width / gImage.Height
gCodecs.Options.Jpeg.Save.SaveWithStamp = True
gCodecs.Save(gImage, "c:\tmp.jpg", RasterImageFormat.ExifJpeg, gImage.BitsPerPixel)
' load the stamp. it was changed to 160 x 120, centered and padded with black
rview1.Image = gCodecs.ReadStamp("c:\tmp.jpg", 1)
' make a thumbnail tImage
tImage = New RasterImage(RasterMemoryFlags.Conventional, 160 * gImage.Width / gImage.Height, 160, 24, RasterByteOrder.Bgr, Nothing, Nothing, Nothing, Nothing)
resizeCmd.DestinationImage = tImage
resizeCmd.Flags = RasterSizeFlags.Bicubic
resizeCmd.Run(gImage)
' save it with savestamp
gCodecs.SaveStamp(tImage, "c:\tmp.jpg", 1, 1, 1, CodecsSavePageMode.Overwrite)
' the result is correct, 80x160
rview2.Image = gCodecs.ReadStamp("c:\tmp.jpg", 1)
RasterCodecs.Shutdown()
End Sub
End Class