TIFF/Image clean-up / compression component

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi

We are looking for a component that offers that offers the below for Tiff
files:

Image clean-up (deskew, despeckle)
Printing capabilities from VB
The ability to add text to image, e.g. time / date

Nice to have:
Image compression/optimisation.
The above for PDFs

Future options:
OCR capabilities


We have been looking at www.vintasoft.com/ which is excellently priced at
$50 US, but does not offer Printing / Addition of Text.

Other options we have looked at are well over $1000 dollars and often
requires expensive runtime licences.

Are there any low cost alternatives that do not sacrifice functionality.

Thanks
B
 
how easy is it to add text to a tiff? and example would be nice for those
of us that do not find it that easy.

thanks
 
Here is code that will allow you to select a jpg file, look for a creation
date in the EXIF info of the header and if such is found print it in red
text in the lower left hand corner of the image which is then displayed in a
picturebox on the form.

You could modify it to print any text you wish in any location on the image
and then save it to a file. To do a Tiff just make the appropriate changes
(I am not up on any information in the header of tiff files so this part
would have to be omitted)

Dim MyText As String = ""

Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8

Dim OpenFileDialog1 As New OpenFileDialog

OpenFileDialog1.Filter = "Jpeg Files(*.JPG)|*.JPG"

OpenFileDialog1.ShowReadOnly = False

If Not OpenFileDialog1.ShowDialog = DialogResult.OK Then Exit Sub



Try

SourceFile = OpenFileDialog1.FileName

MyImage = New Bitmap(OpenFileDialog1.FileName)

Dim AProp As System.Drawing.Imaging.PropertyItem

'Scan through all the property items (if any) in image

'and put them into the string s

For Each AProp In MyImage.PropertyItems

Try 'Some cameras are non-standard; hence TryCatch

Select Case AProp.Id.ToString("x")

Case "9003" 'Date

If Trim(encoding.GetString(AProp.Value)) <> _

"" Then

MyText = encoding.GetString(AProp.Value) & vbNewLine

Else

MsgBox("There is no Creation date for the photo")

Exit Sub

End If

End Select

Catch

End Try

Next



MyText = Replace(MyText, Chr(0), "")

If MyText = "" Then

MyText = "No EXIF information with this image"

MsgBox(MyText)

Exit Sub

End If



'now write the date on the image

Dim g As System.Drawing.Graphics

g = Graphics.FromImage(MyImage)

g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit

Dim objFont As Font = New Font("Arial", 16, FontStyle.Bold,
GraphicsUnit.Pixel)

' Write out the text

g.DrawString(MyText, objFont, Brushes.Red, 3, MyImage.Height - 20)

Me.PictureBox1.Image = MyImage



Catch ex As Exception

MsgBox(ex.Message.ToString)

End Try
 
William,

this does not add the text to the actual file... it only over-lays a
control.

I think that the OP wants to be able to add Text Annotation to a TIF file,
and either FAX or PRINT the TIF file with this extra information.

My interest lies in the ability to add the TEXT annotation to directly in
the TIF file ... I have an application that needs to distribute patient care
forms - either by fax or secure email. The care forms, a scanned image
(tif), are stored in the database and each time they are needed, a local
temp file is created on the host machine. What I would like to be able to
do, is when i create the TIF, I would like to add 'Database Fields' to the
header of the TIF (text annotation). The problem is, I can not use a visual
control to do this 'overlay' - as I need to be able to print / fax this file
as seen on the screen and as it is stored in the temporary file. It must be
able to handle a non-visual environment as I have a fax service that runs
unattended on a seperate machine and must be able to do this with out a
VISUAL component.

So, for display purposes, this works fine for jpg's bmp's, gifs and so on -
tradition IMAGE files ... I am not too sure it will work with TIF's or not -
as these are not typical 'image files'. As far as actually adding the text
to the TIF file, this does not work.

Jeff.
 
Yes. But then you can simply save the image to a file. In the code I
posted, MyImage was a form-wide declared image (which was also used as the
source of the picturebox). To save MyImage which now has the date written
on it, simply do a MyImage.Save(the path to save to). With Jpegs there are
compression considerations, but with a TIFF that isn't a consideration.
 
As expected, your code does not work with TIF files ... get the following
error...

So, again, I ask you how easy it is to add text (annotation) to a TIF
file... as per OP request.

Thanks
Jeff
 
Well, TIFF covers a lot of different modes: Indexed Color, RGB, Grayscale,
CMYK. So in whatever program that is being used to create the TIFF in the
first place, have it save the file in a non-indexed mode, e.g. RGB
 
Back
Top