Picture Class + Console App

Hi All,

I am moving an windows desktop app to a windows console app. One of the task I am trying to do is generate an image using the picture class and save as JPEG. I noticed that on the windows app, I am using GDIPlus but in console app, it doesn’t support it. This is ok; however, the results I am seeing is different. When GDIPLus is not used, the text I am drawing on the image doesn’t show.

Is there away for text that I am drawing on the image to show on the image in a console app?

here is my code:

[code]
select case imageRef
case 1
if file_dcm_parent.Exists = true then file_dcm_parent.Delete
case 2
if file_dcm_child.Exists = true then file_dcm_child.Delete

end select

dim pic as new Picture(300, 300)

pic.Graphics.ForeColor = &c000000
pic.Graphics.FillRect 0,0,300,300

gen_image_text(pic, 20, prop_pat_mrn)
gen_image_text(pic, 40, prop_pat_name)
gen_image_text(pic, 60, prop_pat_dob)
gen_image_text(pic, 80, prop_pat_gender)
gen_image_text(pic, 120, prop_study_accession_number)
gen_image_text(pic, 140, prop_study_procedure_date)
gen_image_text(pic, 160, prop_series_modality)
gen_image_text(pic, 180, prop_study_sop_class_uid)
gen_image_text(pic, 220, prop_study_institution_name)
gen_image_text(pic, 290, str(prop_image_instance_number))

select case imageRef
case 1
pic.Save(file_dcm_parent, picture.SaveAsJPEG)

case 2
pic.Save(file_dcm_child, picture.SaveAsJPEG)

end select[/code]

In a console app, I am having issues getting the text to display on image. This code does work in a windows desktop app using GDIPlus.

[code]Private Sub gen_image_text(pic As Picture, yPos as Integer, inputText As String)

dim outputText As New StringShape

outputText.Text = inputText
outputText.TextFont = “Courier”
outputText.TextSize = 16
outputText.Bold= True
outputText.FillColor = &cFFFFFF
outputText.X = 10
outputText.Y = yPos
outputText.HorizontalAlignment = StringShape.Alignment.Left

pic.Graphics.DrawObject outputText

End Sub
[/code]

[code]Public Sub gen_image_pic(imageRef as Integer)

select case imageRef
case 1
if file_dcm_parent.Exists = true then file_dcm_parent.Delete
case 2
if file_dcm_child.Exists = true then file_dcm_child.Delete

end select

dim pic as new Picture(300, 300)

pic.Graphics.ForeColor = &c000000
pic.Graphics.FillRect 0,0,300,300

gen_image_text(pic, 20, prop_pat_mrn)
gen_image_text(pic, 40, prop_pat_name)
gen_image_text(pic, 60, prop_pat_dob)
gen_image_text(pic, 80, prop_pat_gender)
gen_image_text(pic, 120, prop_study_accession_number)
gen_image_text(pic, 140, prop_study_procedure_date)
gen_image_text(pic, 160, prop_series_modality)
gen_image_text(pic, 180, prop_study_sop_class_uid)
gen_image_text(pic, 220, prop_study_institution_name)
gen_image_text(pic, 290, str(prop_image_instance_number))

select case imageRef
case 1
pic.Save(file_dcm_parent, picture.SaveAsJPEG)

case 2
pic.Save(file_dcm_child, picture.SaveAsJPEG)

end select
End Sub
[/code]