Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm converting a TIF image to JPG and I get this error on the bold line:

 

Public Sub IP()

 

Dim strFileToConvert As String

strFileToConvert = "C:\source1.Tif"

Dim b As New Bitmap(strFileToConvert)

Dim g As Graphics()

 

Dim bold As Font = New Font("Times New Roman", 10, FontStyle.Bold)

 

g.DrawString("This is a test", bold, Brushes.Black, 10.0F, 10.0F)

 

b.Save(strFileToConvert + ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)

 

End Sub

 

how can I add the font? I tried : Dim g As New Graphics() but that didnt work either...

 

Thx

  • *Experts*
Posted (edited)

You are declaring an array of Graphics objects. Another thing is that you need to set the Graphics object to the image. Declare it like this:

   Dim g As Graphics = Graphics.FromImage(b)
   

Edited by mutant

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...