Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #2418

Re: VB6 Image Resizer

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups comp.lang.basic.visual.misc, microsoft.public.vb.general.discussion
Subject Re: VB6 Image Resizer
Date 2020-03-28 10:04 -0400
Organization A noiseless patient Spider
Message-ID <r5nlho$5i0$1@dont-email.me> (permalink)
References <r5mjl1$g3p$1@dont-email.me>

Cross-posted to 2 groups.

Show all headers | View raw


"GS" <gs@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. :)

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

VB6 Image Resizer GS <gs@v.invalid> - 2020-03-28 00:26 -0400
  Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-28 10:04 -0400
    Re: VB6 Image Resizer Arne Saknussemm <es215.10.wannabet@spamgourmet.com> - 2020-03-28 17:17 +0100
      Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-28 14:12 -0400
      Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-28 14:43 -0400
        Re: VB6 Image Resizer Arne Saknussemm <es215.10.wannabet@spamgourmet.com> - 2020-03-29 15:48 +0200
          Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-29 10:41 -0400
          Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-29 13:30 -0400
            Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-29 13:54 -0400
              Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-29 15:36 -0400
                Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-29 16:19 -0400
                Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-29 18:40 -0400
                Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-29 18:49 -0400
                Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-29 23:17 -0400
                Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-30 07:44 -0400
                Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-30 09:52 -0400
                Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-30 12:37 -0400
                Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-30 13:35 -0400
    Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-28 14:59 -0400
      Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-28 16:39 -0400
        Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-28 17:57 -0400
        Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-28 18:44 -0400
          Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-28 22:49 -0400
            Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-29 13:22 -0400
  Re: VB6 Image Resizer "Peter T" <askmy@email.com> - 2020-03-30 17:29 +0100
    Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-30 12:34 -0400
      Re: VB6 Image Resizer "Peter T" <askmy@email.com> - 2020-03-31 10:59 +0100
        Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-31 09:43 -0400
        Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-31 12:53 -0400
  Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-30 18:20 -0400
    Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-30 18:50 -0400
    Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-30 18:56 -0400
      Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-30 21:24 -0400
        Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-30 21:30 -0400
          Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-30 22:01 -0400
            Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-30 22:11 -0400
  Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-31 17:41 -0400
    Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-31 17:51 -0400
      Re: VB6 Image Resizer "Mayayana" <mayayana@invalid.nospam> - 2020-03-31 21:08 -0400
        Re: VB6 Image Resizer GS <gs@v.invalid> - 2020-03-31 21:14 -0400

csiph-web