Results 1 to 4 of 4

Thread: VB & image

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    1
    Hi,
    Does anyone know how to read a user defined image format
    (NOT .jpg .bmp , etc) into picturebox or any other control.?
    and how I can transfer the image into .bmp or .jpg format?

    I can read the image into a buffer and use Pset to
    set the color and display on the picturebox,
    but it seems not working properly, and I cannot save
    it to be jpg format.

    Thanks,

    Austin

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Save as JPEG is not built in

    You have to use third party controls or a type library someone else has made to do it.

    As far as reading a user defined image format, thats easy as long as you are given details on the structures used and how they work. If you're just given a lump of data, you'd have to be lucky or have a good background in image formats to recognize it.

    You might need to provide more info on the UDT to get a meaningful reply. If you want a link to the JPG type library I have found useful, try http://vbaccelerator.com/codelib/gfx/vbjpeg.htm

    Regards
    Paul Lewis

  3. #3
    Hyperactive Member theman32x's Avatar
    Join Date
    May 2000
    Location
    New Jersey, USA
    Posts
    305
    i don't know about loading different image files but to save it into another format what i usually do and it works is to save it with the extension you want ---

    savepicture picture1.image "c:\cool.jpg"

  4. #4
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Angry Sorry ... but no...

    theman32x, here is a simple test for you to try...

    Apart from reading the documentation which tells us that SavePicture does not save JPG format...try this out

    Create a picturebox and throw a JPG into it. My one is a 20K jpg.

    Use SavePicture to save this as "c:\cool.jpg".

    Now use SavePicture to save it as "c:\cool.bmp"

    Now file compare the two, or just look at the filesizes. You will see that both are the same, and both are bigger than the original by quite alot.

    In my case, both were 111k in size. The reason you think it works is because most graphincs programs including LoadPicture don't care about the extension, and look instead at the header in the image file.

    Also, double clicking the icon on your c:\ works because your association to jpg and to bmp is probably the same tool. Once the tool tries to open the file it simply reads the header and lodas the image...

    I hope you try it to see for yourself.

    Cheers

    Paul Lewis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width