Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Saturday, March 21, 2009 11:07:45 AM(UTC)


Groups: Registered
Posts: 6

(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

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)

' 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

' 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)


End Sub
End Class


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, March 23, 2009 1:22:16 AM(UTC)

Adnan Ismail  

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Your code is correct and there is nothing wrong in it. However, there are 2 cases for saving the stamps:

1- Using the RasterCodecs.Save() method:
In this case, you can not specify the dimensions as you want. This is documented in the help topic " File Formats: Exif Formats (TIFF and JPG)" in our help files.
You can check it using this link to our Web help: http://www.leadtools.com...eFormatsExifFormats.html

2- Using the RasterCodecs.SaveStamp() method:
In this case, you can specify the dimensions you want to save the stamp with (although this is not recommended with Exif files). This is documented in the "SaveStamp()" topic in our .NET help file.
You can check it using this link to our Web help:

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-2023, Yet Another Forum.NET
This page was generated in 0.075 seconds.