"GS" <g...@v.invalid> wrote
| I've been searching for ideas on how to manage batch resizing of images in
a
| VB6.exe explorer app, but not finding much.
I don't know if this will be what you want, but
I've needed to do that in the past for an Explorer
Bar. I also did it with a script-based HTA image
viewer, but that one just uses IE to resize (which
works surprisingly well).
A couple of things:
https://www.jsware.net/jsware/vbcode.php5#jpgthumbs
That has two projects. One extracts JPG thumbnails.
The other is code for turbojpeg, the best, fastest method
I could find to resize very large JPSs in order to create
a thumbnail. For basic resizing of a bitmap... that's a whole
other topic.
My approach was trying to get a thumbnail as fast as
possible to display in the Bar when an image file is selected.
A thumbnail is clearly fastest, but not always available.
So I was using a combination of methods.
Here's a VBScript version that can extract either JPG or
RGB versions of JPG thumbnails. It could be adapted for
VB:
https://www.jsware.net/jsware/scrfiles.php5#jpginf
(Little known fact: Most thumbnails in JPGs are JPGs,
but they can also be BMPs or an obscure 3rd type. This
script can extract the first two.)
You can also do all sorts of things with WIA. The syntax
of functions is horrendous, but the help provides samples.
If I remember correctly, though, it's actually quite slow.
But here's my HTA image editor that uses it:
https://www.jsware.net/jsware/scrfiles.php5#wiaed
This is the gist of the resize function, assuming you
already have the objects set up.
Set ImProc = CreateObject("WIA.ImageProcess")
Set ImgFile = CreateObject("WIA.ImageFile")
'--clear out all filters:
While (ImProc.Filters.Count > 0): ImProc.Filters.Remove 1: Wend
'-- add the resize filter:
ImProc.Filters.Add ImProc.FilterInfos("Scale").FilterID
'-- set sizes:
ImProc.Filters(1).Properties("MaximumWidth") = SelWidth
ImProc.Filters(1).Properties("MaximumHeight") = SelHeight
ImProc.Filters(1).Properties("PreserveAspectRatio") = True
Set ImgFile = ImProc.Apply(ImgFile)
You can use that in VB. WIA can do a lot of things. But
MS seem to have put some kind of halfwit in charge of
designing and implementing it. I don't really get the point
of it, aside from the scanner interface it introduced.
You might also be able to somehow hijack whatever IE is
using to resize. It does a beautiful job, very fast. Since you're
re-inventing the wheel there's no reason not to reuse the rim. :)