How to specify bits/pixel and pixels/metre while saving image in vb6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sudhirsahni
    New Member
    • Jun 2010
    • 1

    #1

    How to specify bits/pixel and pixels/metre while saving image in vb6

    Operating System: Windows 2000 Professional SP4
    Language: Visual Basic 6 SP6

    I have written the following program to draw a page to be used for answering multichoice quizzes. The bmp file is created with bitcount 24 and xPelsPerMeter = 0 and yPelsPerMeter = 0.

    I want to create a monochrome image (bitcount =1) with specific PelsPerMeter (to get a 200 dpi image). I cannot find any properties of picturebox to specify these.

    Please help. Thanks.

    ---------------------------------------------------------
    Private Sub Command1_Click( )
    Dim x, y As Integer
    Picture1.DrawWi dth = 20
    Picture1.PSet (40, 40)
    Picture1.DrawWi dth = 1
    For y = 0 To 21
    For x = 0 To 4
    Picture1.Line (100 + 40 * x, 100 + 40 * y)-(120 + 40 * x, 120 + 40 * y), , B
    Next x
    Next y
    Picture1.DrawWi dth = 20
    Picture1.PSet (750, 1080)
    SavePicture Picture1.Image, "answers.bm p"
    End
    End Sub
    -------------------------------------------------------
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    Okay, with the save picture function you are only going to be able to save the image as a bitmap, and as such its pixels per inch is going to be dependent upon the monitor the image is displayed upon. Then its physical size will be dependent upon the size that you create it. Meaning, if you put a picture box on your form, set its and the forms scalemode to vbpixels and set its width to 204, you will be able to save a picture via the savepicture function that has a width of 200.

    Now, since you are using Win2k Pro, you can use the Wang/Kodak imaging controls or WIA 2.0 (the thing that replaced those controls), GDI or GDI+, and a few other methods to save the picture created into various different methods.

    Also, the savepicture function will save your picture as a 24 bit bmp.



    Good Luck

    Comment

    Working...