472,141 Members | 1,414 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,141 software developers and data experts.

TIFF/Image clean-up / compression component

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
Mar 5 '07 #1
7 3616
I have added text to an image. It is fairly easy.

As to printing an image, I haven't tried it in VB. A Google search produces
some examples, e.g. http://www.codeproject.com/useritems/PrintBasics.asp.

So possibly you could do a call to their software to clean up the file and
then do your own text addition and printing.
"Ben" <Be*@Newsgroups.microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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

Mar 5 '07 #2

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

"William LaMartin" <la******@tampabay.rr.comwrote in message
news:u9**************@TK2MSFTNGP04.phx.gbl...
>I have added text to an image. It is fairly easy.

As to printing an image, I haven't tried it in VB. A Google search
produces some examples, e.g.
http://www.codeproject.com/useritems/PrintBasics.asp.

So possibly you could do a call to their software to clean up the file and
then do your own text addition and printing.
"Ben" <Be*@Newsgroups.microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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


Mar 6 '07 #3
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
"jeff" <jhersey at allnorth dottt comwrote in message
news:um**************@TK2MSFTNGP02.phx.gbl...
>
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

"William LaMartin" <la******@tampabay.rr.comwrote in message
news:u9**************@TK2MSFTNGP04.phx.gbl...
>>I have added text to an image. It is fairly easy.

As to printing an image, I haven't tried it in VB. A Google search
produces some examples, e.g.
http://www.codeproject.com/useritems/PrintBasics.asp.

So possibly you could do a call to their software to clean up the file
and then do your own text addition and printing.
"Ben" <Be*@Newsgroups.microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>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



Mar 7 '07 #4
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.


"William LaMartin" <la******@tampabay.rr.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
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
"jeff" <jhersey at allnorth dottt comwrote in message
news:um**************@TK2MSFTNGP02.phx.gbl...
>>
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

"William LaMartin" <la******@tampabay.rr.comwrote in message
news:u9**************@TK2MSFTNGP04.phx.gbl...
>>>I have added text to an image. It is fairly easy.

As to printing an image, I haven't tried it in VB. A Google search
produces some examples, e.g.
http://www.codeproject.com/useritems/PrintBasics.asp.

So possibly you could do a call to their software to clean up the file
and then do your own text addition and printing.
"Ben" <Be*@Newsgroups.microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
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



Mar 7 '07 #5
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.


"jeff" <jhersey at allnorth dottt comwrote in message
news:eV**************@TK2MSFTNGP05.phx.gbl...
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.


"William LaMartin" <la******@tampabay.rr.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>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
"jeff" <jhersey at allnorth dottt comwrote in message
news:um**************@TK2MSFTNGP02.phx.gbl...
>>>
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

"William LaMartin" <la******@tampabay.rr.comwrote in message
news:u9**************@TK2MSFTNGP04.phx.gbl...
I have added text to an image. It is fairly easy.

As to printing an image, I haven't tried it in VB. A Google search
produces some examples, e.g.
http://www.codeproject.com/useritems/PrintBasics.asp.

So possibly you could do a call to their software to clean up the file
and then do your own text addition and printing.
"Ben" <Be*@Newsgroups.microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl. ..
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
>




Mar 7 '07 #6

As expected, your code does not work with TIF files ... get the following
error...
>>A Graphics object cannot be created from an image that has an indexed
pixel format.<<
So, again, I ask you how easy it is to add text (annotation) to a TIF
file... as per OP request.

Thanks
Jeff

"William LaMartin" <la******@tampabay.rr.comwrote in message
news:et**************@TK2MSFTNGP06.phx.gbl...
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.


"jeff" <jhersey at allnorth dottt comwrote in message
news:eV**************@TK2MSFTNGP05.phx.gbl...
>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.


"William LaMartin" <la******@tampabay.rr.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>>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
"jeff" <jhersey at allnorth dottt comwrote in message
news:um**************@TK2MSFTNGP02.phx.gbl...

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

"William LaMartin" <la******@tampabay.rr.comwrote in message
news:u9**************@TK2MSFTNGP04.phx.gbl...
>I have added text to an image. It is fairly easy.
>
As to printing an image, I haven't tried it in VB. A Google search
produces some examples, e.g.
http://www.codeproject.com/useritems/PrintBasics.asp.
>
So possibly you could do a call to their software to clean up the file
and then do your own text addition and printing.
>
>
"Ben" <Be*@Newsgroups.microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
>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
>>
>
>




Mar 7 '07 #7
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

"jeff" <jhersey at allnorth dottt comwrote in message
news:u9**************@TK2MSFTNGP02.phx.gbl...
>
As expected, your code does not work with TIF files ... get the following
error...
>>>A Graphics object cannot be created from an image that has an indexed
pixel format.<<

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

Thanks
Jeff

"William LaMartin" <la******@tampabay.rr.comwrote in message
news:et**************@TK2MSFTNGP06.phx.gbl...
>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.


"jeff" <jhersey at allnorth dottt comwrote in message
news:eV**************@TK2MSFTNGP05.phx.gbl...
>>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.


"William LaMartin" <la******@tampabay.rr.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl.. .
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
"jeff" <jhersey at allnorth dottt comwrote in message
news:um**************@TK2MSFTNGP02.phx.gbl...
>
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
>
>
>
"William LaMartin" <la******@tampabay.rr.comwrote in message
news:u9**************@TK2MSFTNGP04.phx.gbl.. .
>>I have added text to an image. It is fairly easy.
>>
>As to printing an image, I haven't tried it in VB. A Google search
>produces some examples, e.g.
>http://www.codeproject.com/useritems/PrintBasics.asp.
>>
>So possibly you could do a call to their software to clean up the
>file and then do your own text addition and printing.
>>
>>
>"Ben" <Be*@Newsgroups.microsoft.comwrote in message
>news:%2****************@TK2MSFTNGP04.phx.gbl. ..
>>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
>>>
>>
>>
>
>




Mar 7 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Robin Becker | last post: by
17 posts views Thread by PyPK | last post: by
2 posts views Thread by Al Reid | last post: by
6 posts views Thread by qysbc | last post: by
1 post views Thread by amit gupta | last post: by
3 posts views Thread by Andres Corrada-Emmanuel | last post: by
5 posts views Thread by Sameer Gupta | last post: by
1 post views Thread by Stedak | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.