Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Drawing Rectangle on .Tiff image

Drawing Rectangle on .Tiff image

Scheduled Pinned Locked Moved Visual Basic
graphicshelp
4 Posts 2 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zulfikar Ali
    wrote on last edited by
    #1

    i am trying to draw a rectganle on a .tiff image and then save the image. right now it's just saving a .tiif file nogthing on it. here is the code. your help is greatly appreciated. thanks:confused: g = picImage.CreateGraphics() Dim objBmp As Bitmap = New Bitmap(picImage.Size.Width, picImage.Size.Height, Imaging.PixelFormat.Format64bppPArgb) objBmp.FromFile(strPath & curF & ".tif") g.FromImage(objBmp) 'Sets the position of the mouse finishX = e.X finishY = e.Y up = New Point(finishX, finishY) 'Sets the value of rectangle, x, y, width, height position rect = New Rectangle(Math.Min(up.X, down.X), Math.Min(up.Y, down.Y), Math.Abs(up.X - down.X), Math.Abs(up.Y - down.Y)) 'draws and fills rectagnle g.DrawImage(objBmp, rect) 'New Rectangle(0, 0, objBmp.Width, objBmp.Height), 0, 0, objBmp.Width, objBmp.Height, GraphicsUnit.Pixel) g.DrawRectangle(Pens.Black, rect) g.FillRectangle(New SolidBrush(Color.White), rect) objBmp.Save(strPath & curF & "s" & ".tif", Imaging.ImageFormat.Tiff) g.Dispose() objBmp.Dispose() Zulfikar Ali

    C 1 Reply Last reply
    0
    • Z Zulfikar Ali

      i am trying to draw a rectganle on a .tiff image and then save the image. right now it's just saving a .tiif file nogthing on it. here is the code. your help is greatly appreciated. thanks:confused: g = picImage.CreateGraphics() Dim objBmp As Bitmap = New Bitmap(picImage.Size.Width, picImage.Size.Height, Imaging.PixelFormat.Format64bppPArgb) objBmp.FromFile(strPath & curF & ".tif") g.FromImage(objBmp) 'Sets the position of the mouse finishX = e.X finishY = e.Y up = New Point(finishX, finishY) 'Sets the value of rectangle, x, y, width, height position rect = New Rectangle(Math.Min(up.X, down.X), Math.Min(up.Y, down.Y), Math.Abs(up.X - down.X), Math.Abs(up.Y - down.Y)) 'draws and fills rectagnle g.DrawImage(objBmp, rect) 'New Rectangle(0, 0, objBmp.Width, objBmp.Height), 0, 0, objBmp.Width, objBmp.Height, GraphicsUnit.Pixel) g.DrawRectangle(Pens.Black, rect) g.FillRectangle(New SolidBrush(Color.White), rect) objBmp.Save(strPath & curF & "s" & ".tif", Imaging.ImageFormat.Tiff) g.Dispose() objBmp.Dispose() Zulfikar Ali

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      And what are the values in rect ? Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

      Z 1 Reply Last reply
      0
      • C Christian Graus

        And what are the values in rect ? Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

        Z Offline
        Z Offline
        Zulfikar Ali
        wrote on last edited by
        #3

        i am getting the value from mouse. for example it could be anything. the thing is that when it saves it reduces the file size and if i open it it's just blank. Zulfikar Ali

        C 1 Reply Last reply
        0
        • Z Zulfikar Ali

          i am getting the value from mouse. for example it could be anything. the thing is that when it saves it reduces the file size and if i open it it's just blank. Zulfikar Ali

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Zulfikar Ali wrote: for example it could be anything Yes, but what IS it ? Did you step into the code and make sure it was something that should draw a decent rectangle ? Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002 Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups