Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Height

Status
Not open for further replies.

eramgarden

Programmer
Joined
Aug 27, 2003
Messages
279
Location
US
I have a 500x700 canvas, have an image on top of it...

I want to find where the image ends on the canvas and add a line of text to the bottom ...images can be of different height and width

I tried to use Height of canvas, height of image , subtract...but i dont think that would work because i need the values in pixels...not sure...

This is what i have-
Code:
Dim strFileToConvert As String

        strFileToConvert = "C:\source2.Tif"
        'Initialize the bitmap object by supplying the image file path
        Dim b As New Bitmap(strFileToConvert)
       [b] Dim Canvas As New Bitmap(500, 700) [/b]

        Dim g As Graphics = Graphics.FromImage(b)
        Dim gr As Graphics = Graphics.FromImage(Canvas)

        'get size of the image
      [b]  Dim ImageHieght = b.Height()
        Dim CanvasHeight = Canvas.Height() [/b]

        Dim bgBrush = New SolidBrush(System.Drawing.Color.White)

        gr.FillRectangle(bgBrush, New Rectangle(0, 0, 500, 700))
        gr.DrawImage(b, 0.0F, 0.0F)

              Dim copy As Font = New Font("Times New Roman", 9, FontStyle.Regular)


        gr.DrawString("Copyright © 1994-2004 Test ", copy, Brushes.Black, 10.0F, 350.0F)
       
        Canvas.Save(strFileToConvert + ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
        Canvas.Dispose()

any ideas on how i can find out where the height of the image ends?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top