Solved

Use VB 6 to resize jpg and save resized file

Posted on 2004-09-09
4
487 Views
Last Modified: 2008-02-01
Hi:

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.

ksm
0
Comment
Question by:ksm
  • 2
4 Comments
 

Expert Comment

by:mjdmjd
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.

http://www.imagemagick.net/www/download.html?

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

hope this helps

0
 
LVL 7

Accepted Solution

by:
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 http://www.vbaccelerator.com/home/VB/Code/vbMedia/Saving_Pictures_to_JPG/Using_Intel_JPG_Library/article.asp.

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
   
0
 

Author Comment

by:ksm
ID: 12054817
mjdmjd:

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.

wesbird:

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.

Thanks!
ksm
0
 
LVL 7

Expert Comment

by:wesbird
ID: 12054991
Thanks,

P.S. You can get a later version of the DLL from http://www.dll-files.com/dllindex/dll-files.shtml?ijl15.  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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 139
Embarcadero C++ builder XE10.1 Berlin TRegistry declaration 1 48
Run AutoHotkey script directly from Notepad++ 5 145
print bytes of an integer 6 27
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

730 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