Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.basic.visual.misc > #2417 > unrolled thread
| Started by | GS <gs@v.invalid> |
|---|---|
| First post | 2020-03-28 00:26 -0400 |
| Last post | 2020-03-31 21:14 -0400 |
| Articles | 20 on this page of 40 — 4 participants |
Back to article view | Back to comp.lang.basic.visual.misc
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
Page 1 of 2 [1] 2 Next page →
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-28 00:26 -0400 |
| Subject | VB6 Image Resizer |
| Message-ID | <r5mjl1$g3p$1@dont-email.me> |
Hi All, 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 have the explorer part already done; - it has been working well for the past 10+ years. I need some guidance with how to batch resize a selection of image files (all are JPG format) in the Fileview pane. (It's configured to list files only) Thanks in advance for all/any assistance! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-28 10:04 -0400 |
| Message-ID | <r5nlho$5i0$1@dont-email.me> |
| In reply to | #2417 |
"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. :)
[toc] | [prev] | [next] | [standalone]
| From | Arne Saknussemm <es215.10.wannabet@spamgourmet.com> |
|---|---|
| Date | 2020-03-28 17:17 +0100 |
| Message-ID | <20200328171731.0000601c@eternal-september.org> |
| In reply to | #2418 |
It was Sat, 28 Mar 2020 10:04:29 -0400 when "Mayayana" <mayayana@invalid.nospam> wrote: > (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.) In file... yes, but when "rendered" (which also includes rendered on a NON VISIBLE device context), all images will be DIB images (Device Independed Bitmaps) then they may be stored using whatever format you want, but after you load them into a windows DC (be it a memory area, a window, a printer or whatever else) they'll always be DIB, this eases the task of handling images since the APIs will always use and deal with the same format, makes a lot of sense, and should be taken into account
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-28 14:12 -0400 |
| Message-ID | <r5o437$csb$1@dont-email.me> |
| In reply to | #2419 |
"Arne Saknussemm" <es215.10.wannabet@spamgourmet.com> wrote | > (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.) | | In file... yes, but when "rendered" (which also | includes rendered on a NON VISIBLE device context), | all images will be DIB images (Device Independed | Bitmaps) then they may be stored using whatever | format you want, but after you load them into a | windows DC (be it a memory area, a window, a | printer or whatever else) they'll always be DIB, this | eases the task of handling images since the APIs will | always use and deal with the same format, makes a lot | of sense, and should be taken into account | I'm not sure what your point is. I'm just talking about getting thumbnails out of the JPG header. They're in there as small files. Getting a thumbnail will always be much faster than resizing to thumbnail, when a thumbnail is available. So you extract the JPG thumbnail, then load that into whatever image display. But once you decide to do that you need to be aware that while most tumbnails are JPG, they can actually be 3 formats. I wrote code to check the type and take out a JPG thumbnail file or uncompressed RGB data. I've only seen the latter once or twice. I've never seen the third type and haven't written code to extract it.
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-28 14:43 -0400 |
| Message-ID | <r5o5tf$pbi$1@dont-email.me> |
| In reply to | #2419 |
I maybe should have explained that: One can't just extract a thumbnail and load it into a picturebox. A JPG thumbnail is, in fact, an actual file. But uncompressed RGB thumbnails are in reverse byte order and have no header. So the bytes have to be reversed. Then a header has to be created. Only then do you have a file that can be loaded. (I know there are top-down and bottom-up bitmaps. I don't remember which is which. I just remember that when I extracted the RGB bytes I had to store them in the file in reverse.) There are also other ways the thumbnail can be stored in the header. As far as I know, only the JPG version is stored as an entire file that can be rreconstituted by simply writing the bytes to disk.
[toc] | [prev] | [next] | [standalone]
| From | Arne Saknussemm <es215.10.wannabet@spamgourmet.com> |
|---|---|
| Date | 2020-03-29 15:48 +0200 |
| Message-ID | <20200329154826.00007a8d@eternal-september.org> |
| In reply to | #2421 |
It was Sat, 28 Mar 2020 14:43:48 -0400 when "Mayayana" <mayayana@invalid.nospam> wrote: > I maybe should have explained that: One can't > just extract a thumbnail and load it into a > picturebox. A JPG thumbnail is, in fact, an actual > file. But uncompressed RGB thumbnails are in reverse > byte order and have no header. So the bytes have > to be reversed. Then a header has to be created. > Only then do you have a file that can be loaded. My point is that Windows GDI APIs work on DIBs, those are an in-memory representation of an image which may then be stored to (or retrieved from) whatever format, be it JPG, PNG or whatever, such formats are just STORAGE formats, so instead of focusing on how a given image is stored, it would be a better idea to focus on how to quickly render it, then, to retrieve the image from storage and decode it, there are a bunch of libraries and APIs, so that shouldn't be a big issue, nor it would be how the image is stored, once you load and decode it from storage, you'll have a DIB and that's all you need to show/manipulate it, no need to worry about orientation/format/whatever
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-29 10:41 -0400 |
| Message-ID | <r5qc2o$c40$1@dont-email.me> |
| In reply to | #2427 |
"Arne Saknussemm" <es215.10.wannabet@spamgourmet.com> wrote | My point is that Windows GDI APIs work on DIBs, those | are an in-memory representation of an image which may | then be stored to (or retrieved from) whatever | format, be it JPG, PNG or whatever, such formats are | just STORAGE formats, so instead of focusing on how a | given image is stored You seem to have misunderstood. We all know a raster image is a bitmap. We all know about DIBs. We all know raster image formats are various ways to store various kinds of bitmaps. What I was talking about is the process of getting thumbnails from a JPG. Say you have a 12 MB JPG. To make a thumbnail of that is difficult to do quickly. If you have 30 of them it's going to be very slow. So if they have embedded thumbnails in the EXIF data that will be a much quicker solution. Virtually instant to process 30 files. Those thumbnails are typically something like 160x100. But to extract them you have to know how they're stored, and that can be in several formats. So you read the EXIF header data, look for a thumbnail, check the numeric flag that tells you what type it is, and if it's a type you're prepared to extract then you extract the bytes. If it's JPG then you'll have extracted a complete JPG file. If it's uncompressed RGB data then you'll have extracted the RGB bytes, but in reverse order and without a header. Maybe you could paint that directly to screen without building a BMP file? Possibly. Maybe a JPG thumbnail can also be loaded into a Picture by bytes rather than file path? I seem to remember there was a way to do that. But either way, you need to know about the EXIF storage system in order to get it out.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-29 13:30 -0400 |
| Message-ID | <r5qm0a$lne$1@dont-email.me> |
| In reply to | #2427 |
> It was Sat, 28 Mar 2020 14:43:48 -0400 when > "Mayayana" <mayayana@invalid.nospam> wrote: > >> I maybe should have explained that: One can't >> just extract a thumbnail and load it into a >> picturebox. A JPG thumbnail is, in fact, an actual >> file. But uncompressed RGB thumbnails are in reverse >> byte order and have no header. So the bytes have >> to be reversed. Then a header has to be created. >> Only then do you have a file that can be loaded. > > My point is that Windows GDI APIs work on DIBs, those > are an in-memory representation of an image which may > then be stored to (or retrieved from) whatever > format, be it JPG, PNG or whatever, such formats are > just STORAGE formats, so instead of focusing on how a > given image is stored, it would be a better idea to > focus on how to quickly render it, then, to retrieve > the image from storage and decode it, there are a > bunch of libraries and APIs, so that shouldn't be a > big issue, nor it would be how the image is stored, > once you load and decode it from storage, you'll have > a DIB and that's all you need to show/manipulate it, > no need to worry about orientation/format/whatever The .NET examples I've found seem to do this because when they Save the modified image the format is passed as arg2. Since VB6 doesn't work with the .NET Framework (or does it somehow?) I'm looking to duplicate in VB6! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-29 13:54 -0400 |
| Message-ID | <r5qnc4$1b2$1@dont-email.me> |
| In reply to | #2430 |
>> It was Sat, 28 Mar 2020 14:43:48 -0400 when
>> "Mayayana" <mayayana@invalid.nospam> wrote:
>>
>>> I maybe should have explained that: One can't
>>> just extract a thumbnail and load it into a
>>> picturebox. A JPG thumbnail is, in fact, an actual
>>> file. But uncompressed RGB thumbnails are in reverse
>>> byte order and have no header. So the bytes have
>>> to be reversed. Then a header has to be created.
>>> Only then do you have a file that can be loaded.
>>
>> My point is that Windows GDI APIs work on DIBs, those
>> are an in-memory representation of an image which may
>> then be stored to (or retrieved from) whatever
>> format, be it JPG, PNG or whatever, such formats are
>> just STORAGE formats, so instead of focusing on how a
>> given image is stored, it would be a better idea to
>> focus on how to quickly render it, then, to retrieve
>> the image from storage and decode it, there are a
>> bunch of libraries and APIs, so that shouldn't be a
>> big issue, nor it would be how the image is stored,
>> once you load and decode it from storage, you'll have
>> a DIB and that's all you need to show/manipulate it,
>> no need to worry about orientation/format/whatever
>
> The .NET examples I've found seem to do this because when they Save the
> modified image the format is passed as arg2. Since VB6 doesn't work with the
> .NET Framework (or does it somehow?) I'm looking to duplicate in VB6!
So what I'm looking to do is this:
1. Loop thru a dir and grab each pic file to process;
Already got this working recursively!
Need way to do the following:
2. Determine orientation by examine w/h max to get new width;
This will be 480 if portrait, 640 if landscape.
Aspect ratio will auto-set height.
3. Save the pic file by overwriting existing;
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-29 15:36 -0400 |
| Message-ID | <r5qtcc$cec$1@dont-email.me> |
| In reply to | #2431 |
"GS" <gs@v.invalid> wrote
| Need way to do the following:
| 2. Determine orientation by examine w/h max to get new width;
| This will be 480 if portrait, 640 if landscape.
| Aspect ratio will auto-set height.
|
| 3. Save the pic file by overwriting existing;
|
Here's my image class:
https://www.jsware.net/Files2/imclass.zip
The code works like this:
Dim oPic As StdPicture
Dim ImOb As cImage, ImOb2 As cImage
Set oPic = LoadPicture(sPathSrc)
If (Err.Number = 0) Then
Set ImOb = New cImage
LRet = ImOb.CopyStdPicture(oPic)
'-------
sPathSrc is the path of the image file. So you
load a BMP/JPG/GIF into a StdPicture and then
copy that into the class. From there all sorts of
operations can be done, including resizing, cropping,
etc. and writing a new imahe to disk as BMP or JPG.
These were the most efficient methods I found.
There's also
https://www.jsware.net/Files2/resizetest.zip
That demonstrates that GDI+ resizing is faster than
VB methods using an Image control, with much
better picture quality. It's also slightly better
than WIA in terms of both speed and quality.
For sheer speed with large images I found jpegturbo
was the fastest resizer, by using the closest size
among the 8 (?) presets, then resizing that as needed.
Going from very big down to small is what takes so
much time.
Of course, none of this will handle PNG or TIF.
You'll need external libraries for that. I have code
for rendering PNG in VB, but not for saving as PNG.
And it's slow, anyway.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-29 16:19 -0400 |
| Message-ID | <r5qvsi$u8l$1@dont-email.me> |
| In reply to | #2432 |
> "GS" <gs@v.invalid> wrote > >> Need way to do the following: >> 2. Determine orientation by examine w/h max to get new width; >> This will be 480 if portrait, 640 if landscape. >> Aspect ratio will auto-set height. >> >> 3. Save the pic file by overwriting existing; >> > > > Here's my image class: > > https://www.jsware.net/Files2/imclass.zip > > The code works like this: > > Dim oPic As StdPicture > Dim ImOb As cImage, ImOb2 As cImage > > Set oPic = LoadPicture(sPathSrc) > If (Err.Number = 0) Then > Set ImOb = New cImage > LRet = ImOb.CopyStdPicture(oPic) > > '------- > sPathSrc is the path of the image file. So you > load a BMP/JPG/GIF into a StdPicture and then > copy that into the class. From there all sorts of > operations can be done, including resizing, cropping, > etc. and writing a new imahe to disk as BMP or JPG. > These were the most efficient methods I found. Looks simple enough but was looking to NOT need an image control. I'll give this a try regardless. > > There's also > > https://www.jsware.net/Files2/resizetest.zip downloaded this earlier... > > That demonstrates that GDI+ resizing is faster than > VB methods using an Image control, with much > better picture quality. It's also slightly better > than WIA in terms of both speed and quality. This might be better suited so I'll play with... > > For sheer speed with large images I found jpegturbo > was the fastest resizer, by using the closest size > among the 8 (?) presets, then resizing that as needed. > Going from very big down to small is what takes so > much time. Give the shear volume of pics, speed is important for sure! Some of the files are 6-7mb (jpg camera pics) and others are page scans (jpg); - a few are web source (png) but I'll show her how to SaveAs JPG. > > Of course, none of this will handle PNG or TIF. > You'll need external libraries for that. I have code > for rendering PNG in VB, but not for saving as PNG. > And it's slow, anyway. I'm using SnippingTool to save PNGs as JPGs; - doing this makes a much smaller file, and there are very few in this format to begin with anyway! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-29 18:40 -0400 |
| Message-ID | <r5r85g$mc7$1@dont-email.me> |
| In reply to | #2433 |
"GS" <gs@v.invalid> wrote | > sPathSrc is the path of the image file. So you | > load a BMP/JPG/GIF into a StdPicture and then | > copy that into the class. From there all sorts of | > operations can be done, including resizing, cropping, | > etc. and writing a new imahe to disk as BMP or JPG. | > These were the most efficient methods I found. | | Looks simple enough but was looking to NOT need an image control. I'll give | this a try regardless. Not an image control. A class that provides an image object to simplify operations. You load the file into a StdPicture, then copy that to the image *class*. Then you can resize, crop, write to disk without further handling details.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-29 18:49 -0400 |
| Message-ID | <r5r8l8$p8r$1@dont-email.me> |
| In reply to | #2434 |
> "GS" <gs@v.invalid> wrote > >>> sPathSrc is the path of the image file. So you >>> load a BMP/JPG/GIF into a StdPicture and then >>> copy that into the class. From there all sorts of >>> operations can be done, including resizing, cropping, >>> etc. and writing a new imahe to disk as BMP or JPG. >>> These were the most efficient methods I found. >> >> Looks simple enough but was looking to NOT need an image control. I'll give >> this a try regardless. > > Not an image control. A class that provides an > image object to simplify operations. You load the > file into a StdPicture, then copy that to the image > *class*. Then you can resize, crop, write to disk > without further handling details. Nice! Thanks for clarifying as I know absolutely nothing about working with images. (I use a 3rd party utility for making icons after I design them and screencapture to transparent GIFs) -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-29 23:17 -0400 |
| Message-ID | <r5rod6$4sr$1@dont-email.me> |
| In reply to | #2435 |
"GS" <gs@v.invalid> wrote | Nice! Thanks for clarifying as I know absolutely nothing about working with | images. (I use a 3rd party utility for making icons after I design them and | screencapture to transparent GIFs) | If you don't ffigure it out I can provide more sample code. But it's pretty basic from outside the class. You create an instance from a StdPicture and then use the functions of the class object to do whatever you need. Internally it's as lean as I could get it.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-30 07:44 -0400 |
| Message-ID | <r5sm2n$731$1@dont-email.me> |
| In reply to | #2436 |
> "GS" <gs@v.invalid> wrote > >> Nice! Thanks for clarifying as I know absolutely nothing about working with >> images. (I use a 3rd party utility for making icons after I design them and >> screencapture to transparent GIFs) >> > > If you don't ffigure it out I can provide more sample > code. But it's pretty basic from outside the class. > You create an instance from a StdPicture and then > use the functions of the class object to do whatever > you need. Internally it's as lean as I could get it. Thanks for making it as simple as possible; - still, it'll take awhile for me to digest! At first read I don't see where AspectRatio plays a part; - looks like I need to specify both width and height. This could be problematic where original size is not 3x4 or 4x3 AR, requiring lots of calc code. (Unfortunately most of the pics are NOT either AR) The apps I'm using now auto-adjust according to AR; - I need to duplicate that behavior so I only pass 1 dimension based on orientation derived from the original pic! I could be wrong though! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-30 09:52 -0400 |
| Message-ID | <r5stja$skl$1@dont-email.me> |
| In reply to | #2437 |
"GS" <gs@v.invalid> wrote | Thanks for making it as simple as possible; - still, it'll take awhile for me | to digest! At first read I don't see where AspectRatio plays a part; - looks | like I need to specify both width and height. This could be problematic where | original size is not 3x4 or 4x3 AR, requiring lots of calc code. (Unfortunately | most of the pics are NOT either AR) The apps I'm using now auto-adjust | according to AR; - I need to duplicate that behavior so I only pass 1 dimension | based on orientation derived from the original pic! I could be wrong though! | Wouldn't that just be a calculation? I didn't understand your original note about getting ratio, but I assumed were reducing the largest dimension to 640. So then it's just arithmetic to get the small dim as the same ratio. smalldim = (bigdim \ 640) x orig small dim I haven't looked at this stuff for awhile. I'm wondering whether the class is really the best thing. Maybe if I have a chance I'll try a test, adding the VB Bilinear resize method to the resize test I linked from online. Some time ago we spent a long time dealing with this. I was looking for the fastest thumbnail generator. I finally ended up with turbojpeg + minor resizing. The class I have was for my photo editing program. I assume you want decent quality. The resize test I linked is interesting in that respect. It shows that GDI+ is slightl faster than WIA and much faster than resizing an image control. But it also shows quality differences. I have a 12 MB image of maple trees. GDI+ resizes well but blurs it slightly. VB image control produces far too much contract, making the leaves look like bright color dots. WIA is slightly inferior to GDI+. So GDI+ is best. I expect it's probably also better than StretchBlt, but I don't know for sure. What I also don't know is how the speed and quality of GDI+ resize compare to the straight VB math code for bilinear and bicubic in the cImage class. But maybe I'll try to add that into the test project.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-30 12:37 -0400 |
| Message-ID | <r5t78n$4je$1@dont-email.me> |
| In reply to | #2438 |
Sorry if I wasn't clear! Here's my goal:
Loop a folder of pics and process each as follows...
'get existing dims of each pic;
picWidth = Pic.Width: picHeight = Pic.Height
'determine orientation by testing width to height dims;
IsPortrait = (picHeight > picWidth): IsSquare = (picHeight = picWidth)
'resize accordingly
If IsSquare Then Call ResizeS
If IsPortrait Then Call ResizeP Else Call ResizeL
End If
..where these Resize?() functions will test if the pic is larger than desired
before modifying.
Camera pics are normally 3:4 AR and so should be straight forward; - it's the
self-sized ones that I'm concerned about. In this case there is a filesize
limit as well since these are scans of magazine pages, so I'll need to do
downsizing by percent as well.
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-30 13:35 -0400 |
| Message-ID | <r5takr$ufo$1@dont-email.me> |
| In reply to | #2438 |
I stumbled onto a post by Olaf stating RichClient5 has this capability built into one of its DLLs. I'll look into that as well... -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-28 14:59 -0400 |
| Message-ID | <r5o6rf$vfd$1@dont-email.me> |
| In reply to | #2418 |
As usual, a very thorough response! Big thanks for this info; - I will look into all of it. More about my task: A friend's wife is a hoarder of pics, and snap-happy as well. Problem is that now she has twice filled up the HDD in her laptop to the point of crashing. She has absolutely 100s of 1000s of pics. I decided to introduce her to an external storage device for all data, leaving the laptop HDD for OS+apps only. So far so good! I replaced the original HDD with an equal size SSD and now recovering all her pics from the old HDD onto a 3.5" x 7200RPM external drive (1TB for now). I found this app... https://www.bricelam.net/ImageResizer/ ..which is working to my liking in that it allows selecting pics in WE and lets me configure output sizes. (Resizes 300+ pics in less than 10 seconds) Problem is that it makes some larger not smaller, even though there's an option setting to not do that. Since I already have a working files explorer app I thought I'd just add one more custom feature that does same. I'm replacing existing files with smaller versions suitable for Web use, (640x480) for both orientations (portrait/landscape). So far, Office Picture Manager is doing the best job but it requires hands-on selection of the specific files (their thumbnails) to resize. Very slow so I'm looking to duplicate what/how that ImageResizer app does. I found stuff to convert BMPs to JPG, and lots of .NET solutions but I'm not looking to add this feature to my C# version of the files explorer app. I already have a recursive routine to drill down thru subfolders so just need/want to pass the filename to be resized along with its new dims. -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion
[toc] | [prev] | [next] | [standalone]
| From | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-28 16:39 -0400 |
| Message-ID | <r5ocn9$92v$1@dont-email.me> |
| In reply to | #2422 |
"GS" <gs@v.invalid> wrote | | ..which is working to my liking in that it allows selecting pics in WE and lets | me configure output sizes. (Resizes 300+ pics in less than 10 seconds) Problem | is that it makes some larger not smaller, even though there's an option setting | to not do that. Ah. I thought you wanted to do something like an Explorer thumbnail view. You could take a look at this: https://www.jsware.net/jsware/pprep.php5 I made it mostly for the woman I live with but also sold it as shareware for a few years. You drop a file or folder, then you can batch process a whole folder with resizing and/or cropping. To accommodate a large audience there are only 3 possible sizes, but in the settings you can decide what those are. The cropping was especially aimed at easily creating images with the right ratio for various printing options, to fit an 8x10 frame, a 3x5 print, etc. If it's useful I'm happy to share whatever code you might want. I think most of it uses some very nice code from one Peter Scale, who wrote various image operations in pure VB, including various resizing methods.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.basic.visual.misc
csiph-web