VB6可以将图像保存为JPEG吗? [英] Can VB6 save an image as a JPEG?

查看:344
本文介绍了VB6可以将图像保存为JPEG吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:我不是VB6程序员 - 我是一名Android程序员,负责制造中使用的应用程序,我有一位同事负责与我的Android设备对话的VB6程序。

Note: I am NOT a VB6 programmer - I'm an Android programmer responsible for an app used in manufacturing and I have a colleague responsible for a VB6 program that talks to my Android devices.

过去我们的VB6程序将Microsoft .bmps发送到Android设备,但现在我们正在将平板电脑添加到我们的产品列表中,并希望将更大的图像发送到利用这款平板电脑的额外房地产我们发现.bmp太大而且堵塞了网络。

In the past our VB6 program sent Microsoft .bmps to the Android device, but now that we're adding tablets to our product list, and want to send bigger images to take advantage of the tablet's extra real-estate we find that .bmp's are too big and clog up the network.

最终我们用一个旧的VB6产品取而代之。 Net one,但在我们这样做之前,VB6有什么方法可以通过编程方式将位图转换为JPEG?我的同事不知道一个,但我总是找到S.O.在我的域(Android,.Net)中非常有用,所以我想我会在这里尝试VB6问题。

Eventually we're replacing the old VB6 product with a .Net one, but until we do is there any way for VB6 to programmatically convert a bitmap to a JPEG? My colleague is unaware of one but I've always found S.O. to be very useful in my domains (Android, .Net) so I thought I'd try a VB6 question here.

推荐答案

2002年微软发布Windows®ImageAcquisition Automation Library v2.0工具:用于VB和脚本的图像采集和操作组件

In 2002 Microsoft released Windows® Image Acquisition Automation Library v2.0 Tool: Image acquisition and manipulation component for VB and scripting.

这可以从文件或字节数组接受.BMP甚至原始Windows 24位像素位图(加上宽度和高度)并将它们转换为JPEG,从而生成文件或字节数组结果。

This can accept a .BMP or even a raw Windows 24-bit pixel bitmap (plus width & height) from a file or Byte array and convert them to JPEG, producing a file or Byte array result.

图书馆是现代版Windows的一部分,但可以安装到WinXP(SP1或更高版本)。

The Library is part of modern versions of Windows but can be installed into WinXP (SP1 or better).

简单文件到文件示例:

Dim ImgF As WIA.ImageFile
Dim ImgP As WIA.ImageProcess

Set ImgF = New WIA.ImageFile
ImgF.LoadFile "Zapotec.bmp"
Set ImgP = New WIA.ImageProcess
With ImgP
    .Filters.Add .FilterInfos!Convert.FilterID
    .Filters.Item(1).Properties!FormatID.Value = wiaFormatJPEG
    .Filters.Item(1).Properties!Quality.Value = 70
    Set ImgF = .Apply(ImgF)
End With
ImgF.SaveFile "Zapotec.jpg"

这篇关于VB6可以将图像保存为JPEG吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆