Results 1 to 15 of 15

Thread: VB6 Image and Picture Controls Out of Memory Error 7

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    5

    VB6 Image and Picture Controls Out of Memory Error 7

    Hello,

    While working with a small app to read photos and have found that the Image control does not seem to load files which are larger than a certain (modest) number of Megabytes (fails under 10MB)
    The files are perfectly readable from other apps, Windows preview and fax viewer show them immediately.
    Tried this on another clean PC with ample memory, still same problem.

    Can anyone explain how to overcome this apparent limit ?
    or suggest a better control.

    Thanks

  2. #2
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    Nops

    Perhaps a PictureBox control?

    Spoo

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    Welcome to the forums.

    The issue is probably with image size, physical dimensions. When the pic/fax viewer displays an image it is most likely scaling the large image to a smaller bitmap and that smaller bitmap is what is displayed. VB picture objects are DIB sections and the system dictates how large a DIB can be created and this is what I think is causing your error.

    The answer may be simply that you will never be able to display them with an image/picturebox control directly. Rather you will have to scale it to a smaller bitmap (say full screen size at max) and then create a stdPicture object from that bitmap.

    Out of curiosity, what are the dimensions of that image?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    LaVolpe

    Thanks for clarification for re: the PictureBox

    Spoo

  5. #5
    Hyperactive Member Quiver318's Avatar
    Join Date
    Sep 2007
    Posts
    260

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    Quote Originally Posted by LaVolpe View Post
    Out of curiosity, what are the dimensions of that image?
    To add to LaVolpe's question, also look at the resolution of the images and the format. You will find that Internet Explorer generally cannot display images in CMYK, although other products might. Perhaps the control cannot, either.

    Monitors only display about 72 DPI (or 96 DPI). If your image has a very high resolution of 600 or 1200 DPI, it contains a great deal of data that is not even being displayed on your monitor (although you will find you can zoom in nicely). Massive resolution might affect this control.

    To give you an idea, I just made some artwork that is 8.5" x 11" (3338 x 2588 pixels) that is high resolution of 300 DPI (for printing), and it is only 5.54 MB. On my monitor, it is absolutely huge.

  6. #6

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    5

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    Thanks to both of you for the swift response.

    The Picturebox control has already been tested with these images.
    Regarding the images themselves.

    1. jpg's, bmp's and tif's tested (however based on 3 images
    2. The resolution was similar to scanner stuff 300 dpi
    3. The size regarding image size was quite big
    Landscape and air stuff so resulted in ~80 cm wide. 5K x 3K px
    Even a 4 MB file but with large dimensions did not load.
    Large extents small resolution 72 dpi does not load
    4. The size 'as file' as indicated were 5, 10 and 50 MBs

    5. Manged to load a 6+MB with around 50 cm size. 5K x 6K px x 24

    That's about it. Have you both had better results ?

    I had read about pixel depth and a bug in the control SW.
    Are you aware of anything like this ?

    Any suggestions ? since I am going to be downloading Blobs from
    a server and there will be certainly files bigger than 10 MBs.

    Thanks


    Quote Originally Posted by LaVolpe View Post
    Welcome to the forums.

    The issue is probably with image size, physical dimensions. When the pic/fax viewer displays an image it is most likely scaling the large image to a smaller bitmap and that smaller bitmap is what is displayed. VB picture objects are DIB sections and the system dictates how large a DIB can be created and this is what I think is causing your error.

    The answer may be simply that you will never be able to display them with an image/picturebox control directly. Rather you will have to scale it to a smaller bitmap (say full screen size at max) and then create a stdPicture object from that bitmap.

    Out of curiosity, what are the dimensions of that image?

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    I still stick by my guesses. Try this just for the fun of it. Change your screen resolution to the lowest it will go, then reload the image. Does it display? If not, it is absolutely huge? DIBs (device independent bitmaps) used by VB simply have limits to how big they can be and is determined by combination of physical size and color depth of the system, not necessarily the image itself in this case. Those limitations fluctuate from system to system.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    5

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    Update:

    Firstly I was concerned that it was the OS, I had 'many' windows open
    however all other apps were running and as stated the photos were
    visible using other standard apps.
    The problem was also present on another clean PC.

    Having done some other tests it seems that :

    Changing the size of the image (not the dimension of the file) seems
    to have a certain effect.
    Also I am considering the compression factor, by default it was LZW
    for the jpgs. [Bmps load immediately and quickly.]

    After applying a few changes the 2 controls loaded a 14 MB jpg (slowly)

    Need to know the size limits for the Photos (what is the criteria)

    Screen Resolution :
    The other PC was running on a lower resolution and as mentioned the
    control did not load certain large (cms) jpgs.

    What are your PC's offering as regards performance ?

    Did you find that .tif files will not load ? [481 error]

    Any suggestions for other 'better' graphics controls ?
    Thanks again.

  9. #9

  10. #10
    Hyperactive Member Quiver318's Avatar
    Join Date
    Sep 2007
    Posts
    260

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    A JPG file saved in CMYK mode and a JPG saved in RGB mode look the same when displayed on your screen, but they are very different, intrinsically. In testing, I know that the VB6 picture control won’t load a CMYK JPG, no matter the size. There are probably dozens of JPG formats out there, today. CMS JPG, did you say?

    Do you have anything like Photoshop? With it, you can experiment easily with formats, resolutions and modes. Just keep expanding the image size until you find the limitations. Soon, you should find them.

  11. #11

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    5

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    FireXtol : I suggest GDI+.

    Thanks for the comment.
    (the options would be interesting) and it might be a good solution,
    if I was really at ease with writing a wrapper for the business so that
    I could manage it all smoothly in VB.
    Apart from the question of competency I do not have the time.
    At vbaccelerator there is an interesting article on this subject.

    Quiver318:
    Hi, I think that the formats of the jpg's were pretty standard really.
    The fact that they are all readable from other apps concerns me.
    A workaround would be the Preview Library. It seems to load all.

    I would still like to know if this is a local problem (my setup) or if you
    people are managing to do practically everything with the VB controls.

    Thanks for the follow ups

  12. #12
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    You do not need to write any wrappers. There are classes and type libraries already designed to be used in VB6. And most come with many examples.

    I'll PM you a link to one.

  13. #13
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    nops, don't get hung up on the compression or image format. All images are converted to & maintained in memory in bitmap format at some point by the O/S and at different bit depths as needed, additional mask bitmaps as needed.
    Assuming VB can load the image format and the image itself is not corrupted, physical dimensions + bit depth are limiting factors. GDI+ can't help with regards to putting the image into a .Picture property, however, scaling the large image to a smaller bitmap and/or smaller bit depth would certainly work. Else GDI+ and other classes/code can be used to read & display portions as needed. One probably does not even have a screen size capable of displaying that entire image full size anyway?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  14. #14

    Thread Starter
    New Member
    Join Date
    Jun 2010
    Posts
    5

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    Hello,

    Sorry for the delay in responding, busy trying to fix the App
    with the Server and the images.

    Thanks FireXtol for the info, please see the PM response.

    LaVolpe, thanks again for the participation
    Interesting info.
    I have been having a modest success with files over 10 MB
    so long as their dims are not too extensive ~80+cms/6000px.
    I will let you know about the results.

    BTW is that you at http://www.planet-source-code.com/vb/ etc
    with the AlphaImage And Transparency and also at
    http://www.xtremevbtalk.com/

    Thanks again

  15. #15
    Frenzied Member
    Join Date
    Jan 2010
    Posts
    1,103

    Re: VB6 Image and Picture Controls Out of Memory Error 7

    I had an experience one month ago. on my XP/521MB,I want to use GDI+ to open some tiff file which are converted from AutoCAD file. Some can open even though I have to wait for few minutes,some can't.
    1) GDI+ GdipDrawImageRectRectI API did check the file dimension before rendering. If my tiff file is too huge,GdipDrawImageRectRectI will quit immediately.
    2). If that dimension can be handled by GdipDrawImageRectRectI API,GdipDrawImageRectRectI will take few minutes to render. It is system variation,depend on your hardware.
    e.g. a tiff file dimension is 14400x9600pixels,Bits Per Sample is 1,Compression is CCITT Group 4 Fax,Resolution for x and y is 400 DPI.

    <FAILED even on Win7 with Dual core/4G memory>
    GdipDrawImageRectRectI graphics, Image, 0, 0, Width , Height , 0, 0, Width, Height, UnitPixel, 0, 0, 0
    <FAILED on XP/512MB but OK on Win7/4G Memory>
    GdipDrawImageRectRectI graphics, Image, 0, 0, Width / 1.4064, Height / 1.4064, 0, 0, Width, Height, UnitPixel, 0, 0, 0
    <OK,but took 3 minutes>
    GdipDrawImageRectRectI graphics, Image, 0, 0, Width / 1.4065, Height / 1.4065, 0, 0, Width, Height, UnitPixel, 0, 0, 0
    Last edited by Jonney; Jun 16th, 2010 at 08:43 PM.

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