TIFF/Image clean-up / compression component

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben

    #1

    TIFF/Image clean-up / compression component

    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


  • William LaMartin

    #2
    Re: TIFF/Image clean-up / compression component

    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" <Ben@Newsgroups .microsoft.comw rote in message
    news:%23EKzijzX HHA.3256@TK2MSF TNGP04.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
    >

    Comment

    • jeff

      #3
      Re: TIFF/Image clean-up / compression component


      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" <lamartin@tampa bay.rr.comwrote in message
      news:u9NQud1XHH A.2316@TK2MSFTN GP04.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" <Ben@Newsgroups .microsoft.comw rote in message
      news:%23EKzijzX HHA.3256@TK2MSF TNGP04.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
      >>
      >
      >

      Comment

      • William LaMartin

        #4
        Re: TIFF/Image clean-up / compression component

        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.Enc oding = System.Text.Enc oding.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(OpenFile Dialog1.FileNam e)

        Dim AProp As System.Drawing. Imaging.Propert yItem

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

        'and put them into the string s

        For Each AProp In MyImage.Propert yItems

        Try 'Some cameras are non-standard; hence TryCatch

        Select Case AProp.Id.ToStri ng("x")

        Case "9003" 'Date

        If Trim(encoding.G etString(AProp. Value)) <_

        "" Then

        MyText = encoding.GetStr ing(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.FromIm age(MyImage)

        g.TextRendering Hint = Drawing.Text.Te xtRenderingHint .AntiAliasGridF it

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

        ' Write out the text

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

        Me.PictureBox1. Image = MyImage



        Catch ex As Exception

        MsgBox(ex.Messa ge.ToString)

        End Try


        "jeff" <jhersey at allnorth dottt comwrote in message
        news:umdXdkBYHH A.3824@TK2MSFTN GP02.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" <lamartin@tampa bay.rr.comwrote in message
        news:u9NQud1XHH A.2316@TK2MSFTN GP04.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" <Ben@Newsgroups .microsoft.comw rote in message
        >news:%23EKzijz XHHA.3256@TK2MS FTNGP04.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
        >>>
        >>
        >>
        >
        >

        Comment

        • jeff

          #5
          Re: TIFF/Image clean-up / compression component

          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" <lamartin@tampa bay.rr.comwrote in message
          news:%239ZF$WGY HHA.4008@TK2MSF TNGP05.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.Enc oding = System.Text.Enc oding.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(OpenFile Dialog1.FileNam e)
          >
          Dim AProp As System.Drawing. Imaging.Propert yItem
          >
          'Scan through all the property items (if any) in image
          >
          'and put them into the string s
          >
          For Each AProp In MyImage.Propert yItems
          >
          Try 'Some cameras are non-standard; hence TryCatch
          >
          Select Case AProp.Id.ToStri ng("x")
          >
          Case "9003" 'Date
          >
          If Trim(encoding.G etString(AProp. Value)) <_
          >
          "" Then
          >
          MyText = encoding.GetStr ing(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.FromIm age(MyImage)
          >
          g.TextRendering Hint = Drawing.Text.Te xtRenderingHint .AntiAliasGridF it
          >
          Dim objFont As Font = New Font("Arial", 16, FontStyle.Bold,
          GraphicsUnit.Pi xel)
          >
          ' Write out the text
          >
          g.DrawString(My Text, objFont, Brushes.Red, 3, MyImage.Height - 20)
          >
          Me.PictureBox1. Image = MyImage
          >
          >
          >
          Catch ex As Exception
          >
          MsgBox(ex.Messa ge.ToString)
          >
          End Try
          >
          >
          "jeff" <jhersey at allnorth dottt comwrote in message
          news:umdXdkBYHH A.3824@TK2MSFTN GP02.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" <lamartin@tampa bay.rr.comwrote in message
          >news:u9NQud1XH HA.2316@TK2MSFT NGP04.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" <Ben@Newsgroups .microsoft.comw rote in message
          >>news:%23EKzij zXHHA.3256@TK2M SFTNGP04.phx.gb l...
          >>>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
          >>>functionalit y.
          >>>>
          >>>Thanks
          >>>B
          >>>>
          >>>
          >>>
          >>
          >>
          >
          >

          Comment

          • William LaMartin

            #6
            Re: TIFF/Image clean-up / compression component

            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(th e 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:eVi7TuLYHH A.3656@TK2MSFTN GP05.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" <lamartin@tampa bay.rr.comwrote in message
            news:%239ZF$WGY HHA.4008@TK2MSF TNGP05.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.Enc oding = System.Text.Enc oding.UTF8
            >>
            >Dim OpenFileDialog1 As New OpenFileDialog
            >>
            >OpenFileDialog 1.Filter = "Jpeg Files(*.JPG)|*. JPG"
            >>
            >OpenFileDialog 1.ShowReadOnly = False
            >>
            >If Not OpenFileDialog1 .ShowDialog = DialogResult.OK Then Exit Sub
            >>
            >>
            >>
            >Try
            >>
            >SourceFile = OpenFileDialog1 .FileName
            >>
            >MyImage = New Bitmap(OpenFile Dialog1.FileNam e)
            >>
            >Dim AProp As System.Drawing. Imaging.Propert yItem
            >>
            >'Scan through all the property items (if any) in image
            >>
            >'and put them into the string s
            >>
            >For Each AProp In MyImage.Propert yItems
            >>
            > Try 'Some cameras are non-standard; hence TryCatch
            >>
            > Select Case AProp.Id.ToStri ng("x")
            >>
            > Case "9003" 'Date
            >>
            > If Trim(encoding.G etString(AProp. Value)) <_
            >>
            > "" Then
            >>
            > MyText = encoding.GetStr ing(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.FromIm age(MyImage)
            >>
            >g.TextRenderin gHint = Drawing.Text.Te xtRenderingHint .AntiAliasGridF it
            >>
            >Dim objFont As Font = New Font("Arial", 16, FontStyle.Bold,
            >GraphicsUnit.P ixel)
            >>
            > ' Write out the text
            >>
            > g.DrawString(My Text, objFont, Brushes.Red, 3, MyImage.Height - 20)
            >>
            > Me.PictureBox1. Image = MyImage
            >>
            >>
            >>
            >Catch ex As Exception
            >>
            > MsgBox(ex.Messa ge.ToString)
            >>
            >End Try
            >>
            >>
            >"jeff" <jhersey at allnorth dottt comwrote in message
            >news:umdXdkBYH HA.3824@TK2MSFT NGP02.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" <lamartin@tampa bay.rr.comwrote in message
            >>news:u9NQud1X HHA.2316@TK2MSF TNGP04.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" <Ben@Newsgroups .microsoft.comw rote in message
            >>>news:%23EKzi jzXHHA.3256@TK2 MSFTNGP04.phx.g bl...
            >>>>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
            >>>>functionali ty.
            >>>>>
            >>>>Thanks
            >>>>B
            >>>>>
            >>>>
            >>>>
            >>>
            >>>
            >>
            >>
            >
            >

            Comment

            • jeff

              #7
              Re: TIFF/Image clean-up / compression component


              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" <lamartin@tampa bay.rr.comwrote in message
              news:etBxGmNYHH A.2436@TK2MSFTN GP06.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(th e 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:eVi7TuLYHH A.3656@TK2MSFTN GP05.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" <lamartin@tampa bay.rr.comwrote in message
              >news:%239ZF$WG YHHA.4008@TK2MS FTNGP05.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.Enc oding = System.Text.Enc oding.UTF8
              >>>
              >>Dim OpenFileDialog1 As New OpenFileDialog
              >>>
              >>OpenFileDialo g1.Filter = "Jpeg Files(*.JPG)|*. JPG"
              >>>
              >>OpenFileDialo g1.ShowReadOnly = False
              >>>
              >>If Not OpenFileDialog1 .ShowDialog = DialogResult.OK Then Exit Sub
              >>>
              >>>
              >>>
              >>Try
              >>>
              >>SourceFile = OpenFileDialog1 .FileName
              >>>
              >>MyImage = New Bitmap(OpenFile Dialog1.FileNam e)
              >>>
              >>Dim AProp As System.Drawing. Imaging.Propert yItem
              >>>
              >>'Scan through all the property items (if any) in image
              >>>
              >>'and put them into the string s
              >>>
              >>For Each AProp In MyImage.Propert yItems
              >>>
              >> Try 'Some cameras are non-standard; hence TryCatch
              >>>
              >> Select Case AProp.Id.ToStri ng("x")
              >>>
              >> Case "9003" 'Date
              >>>
              >> If Trim(encoding.G etString(AProp. Value)) <_
              >>>
              >> "" Then
              >>>
              >> MyText = encoding.GetStr ing(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.FromIm age(MyImage)
              >>>
              >>g.TextRenderi ngHint = Drawing.Text.Te xtRenderingHint .AntiAliasGridF it
              >>>
              >>Dim objFont As Font = New Font("Arial", 16, FontStyle.Bold,
              >>GraphicsUnit. Pixel)
              >>>
              >> ' Write out the text
              >>>
              >> g.DrawString(My Text, objFont, Brushes.Red, 3, MyImage.Height - 20)
              >>>
              >> Me.PictureBox1. Image = MyImage
              >>>
              >>>
              >>>
              >>Catch ex As Exception
              >>>
              >> MsgBox(ex.Messa ge.ToString)
              >>>
              >>End Try
              >>>
              >>>
              >>"jeff" <jhersey at allnorth dottt comwrote in message
              >>news:umdXdkBY HHA.3824@TK2MSF TNGP02.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" <lamartin@tampa bay.rr.comwrote in message
              >>>news:u9NQud1 XHHA.2316@TK2MS FTNGP04.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" <Ben@Newsgroups .microsoft.comw rote in message
              >>>>news:%23EKz ijzXHHA.3256@TK 2MSFTNGP04.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
              >>>>>functional ity.
              >>>>>>
              >>>>>Thanks
              >>>>>B
              >>>>>>
              >>>>>
              >>>>>
              >>>>
              >>>>
              >>>
              >>>
              >>
              >>
              >
              >

              Comment

              • William LaMartin

                #8
                Re: TIFF/Image clean-up / compression component

                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:u9MPzTOYHH A.1296@TK2MSFTN GP02.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" <lamartin@tampa bay.rr.comwrote in message
                news:etBxGmNYHH A.2436@TK2MSFTN GP06.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(th e path to save to). With Jpegs
                >there are compression considerations, but with a TIFF that isn't a
                >consideratio n.
                >>
                >>
                >>
                >>
                >"jeff" <jhersey at allnorth dottt comwrote in message
                >news:eVi7TuLYH HA.3656@TK2MSFT NGP05.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" <lamartin@tampa bay.rr.comwrote in message
                >>news:%239ZF$W GYHHA.4008@TK2M SFTNGP05.phx.gb l...
                >>>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
                >>>appropriat e 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.Enc oding = System.Text.Enc oding.UTF8
                >>>>
                >>>Dim OpenFileDialog1 As New OpenFileDialog
                >>>>
                >>>OpenFileDial og1.Filter = "Jpeg Files(*.JPG)|*. JPG"
                >>>>
                >>>OpenFileDial og1.ShowReadOnl y = False
                >>>>
                >>>If Not OpenFileDialog1 .ShowDialog = DialogResult.OK Then Exit Sub
                >>>>
                >>>>
                >>>>
                >>>Try
                >>>>
                >>>SourceFile = OpenFileDialog1 .FileName
                >>>>
                >>>MyImage = New Bitmap(OpenFile Dialog1.FileNam e)
                >>>>
                >>>Dim AProp As System.Drawing. Imaging.Propert yItem
                >>>>
                >>>'Scan through all the property items (if any) in image
                >>>>
                >>>'and put them into the string s
                >>>>
                >>>For Each AProp In MyImage.Propert yItems
                >>>>
                >>> Try 'Some cameras are non-standard; hence TryCatch
                >>>>
                >>> Select Case AProp.Id.ToStri ng("x")
                >>>>
                >>> Case "9003" 'Date
                >>>>
                >>> If Trim(encoding.G etString(AProp. Value)) <_
                >>>>
                >>> "" Then
                >>>>
                >>> MyText = encoding.GetStr ing(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.FromIm age(MyImage)
                >>>>
                >>>g.TextRender ingHint = Drawing.Text.Te xtRenderingHint .AntiAliasGridF it
                >>>>
                >>>Dim objFont As Font = New Font("Arial", 16, FontStyle.Bold,
                >>>GraphicsUnit .Pixel)
                >>>>
                >>> ' Write out the text
                >>>>
                >>> g.DrawString(My Text, objFont, Brushes.Red, 3, MyImage.Height - 20)
                >>>>
                >>> Me.PictureBox1. Image = MyImage
                >>>>
                >>>>
                >>>>
                >>>Catch ex As Exception
                >>>>
                >>> MsgBox(ex.Messa ge.ToString)
                >>>>
                >>>End Try
                >>>>
                >>>>
                >>>"jeff" <jhersey at allnorth dottt comwrote in message
                >>>news:umdXdkB YHHA.3824@TK2MS FTNGP02.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" <lamartin@tampa bay.rr.comwrote in message
                >>>>news:u9NQud 1XHHA.2316@TK2M SFTNGP04.phx.gb l...
                >>>>>>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" <Ben@Newsgroups .microsoft.comw rote in message
                >>>>>news:%23EK zijzXHHA.3256@T K2MSFTNGP04.phx .gbl...
                >>>>>>Hi
                >>>>>>>
                >>>>>>We are looking for a component that offers that offers the below for
                >>>>>>Tiff files:
                >>>>>>>
                >>>>>>Image clean-up (deskew, despeckle)
                >>>>>>Printin g 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
                >>>>>>functiona lity.
                >>>>>>>
                >>>>>>Thanks
                >>>>>>B
                >>>>>>>
                >>>>>>
                >>>>>>
                >>>>>
                >>>>>
                >>>>
                >>>>
                >>>
                >>>
                >>
                >>
                >
                >

                Comment

                Working...