Anyone know or has a function who convert png/gif to jpg/tiff

mc1988
mc1988 used Ask the Experts™
on
Need VB6 code help which can a png or gif file to jpg or tiff.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Developer
Fellow 2017
Most Valuable Expert 2018
Commented:
If you're willing to use a third-party (free!) package and make a command line call from your VB6 code, GraphicsMagick can do it. Here are two EE articles that show where/how to download it, as well as some sample calls:

Create a PDF file with Contact Sheets (montage of thumbnails) for all JPG files in a folder and each of its subfolders using an automated, batch method

Create an image (BMP, GIF, JPG, PNG, TIF, etc.) from a multi-page PDF

In your case, you'll use the convert operation and the call will be something like this:

from PNG to JPG:
gm convert input.png output.jpg

from GIF to TIFF:
gm convert input.gif output.tif

There are, of course, many options/parameters that you may want to use. Regards, Joe
Windows XP SP1 and later has Windows Image Acquisition Library v2.0. Just add reference to it in your VB project:
Dim Img 'As ImageFile
Dim IP 'As ImageProcess

Set Img = CreateObject("WIA.ImageFile")
Set IP = CreateObject("WIA.ImageProcess")

Img.LoadFile "C:\YourFile.png"

IP.Filters.Add IP.FilterInfos("Convert").FilterID
IP.Filters(1).Properties("FormatID").Value = wiaFormatJPEG
IP.Filters(1).Properties("Quality").Value = 5

Set Img = IP.Apply(Img)

Img.SaveFile "C:\NewFile.jpg"

Open in new window

Martin LissOlder than dirt
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial