Use VB 6 to resize jpg and save resized file

Posted on 2004-09-09
Last Modified: 2008-02-01

I would like to be able to load in a jpg image, resize it with visual basic (I'm using version 6) and then save the resized image back out as a jpg.  Any ideas?

Thank you.

Question by:ksm
  • 2

Expert Comment

ID: 12019409
I did something similar and used the imagemagik suite - which are basically a bunch of command line image manipulation tools ... which you can use them from VB using the shell command.

You can do loads of stuff, such as converting, resizing, rotating etc ...

hope this helps


Accepted Solution

wesbird earned 125 total points
ID: 12019926
There is a better way to do it if you don;t want to "shell".

Take a look at

You can get the jpg into a DIB object and then do something like this:

    Dim dib As New cDIBSection
    Dim dibThumbnail As cDIBSection
    If LoadJPG(dib, strSrc) Then
        Set dibThumbnail = dib.Resample(Y, X)
        If SaveJPG(dibThumbnail, strDest) Then
            blnSuccess = True
        End If
    End If

Author Comment

ID: 12054817

Thank you for pointing me to the tools.  It seems like a robust package with some very cool features.  I chose wesbird's answer, though, because it seemed a little more seemless and I needed to get something up and running very quickly.


Thank you very much.  I was able to get the code up and running with only minor tweaking.  Easy to integrate.  Worked like a champ.


Expert Comment

ID: 12054991

P.S. You can get a later version of the DLL from  I've been using this one for several months in my app (must have processed 30000 images by now) with no problems.  The version ilj11.dll did bug on about the 5000th image which is why I recommend using ijl15.dll - that one is stable.

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to adjust sheet 1 82
matchUp  challenge 9 72
countPairs challenge 7 58
topping1 challenge 7 53
Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now