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 2 of 2 — ← Prev page 1 [2]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-28 17:57 -0400 |
| Message-ID | <r5oh7m$6hu$1@dont-email.me> |
| In reply to | #2423 |
> "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. Thank you! I'll also look into this Peter Scale to see if any of his works are around... -- 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 18:44 -0400 |
| Message-ID | <r5ok0i$n0d$1@dont-email.me> |
| In reply to | #2423 |
> "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. Found nothing on Peter Scale yet but I'm very interested in the resizing code you use! -- 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 22:49 -0400 |
| Message-ID | <r5p2cp$7s6$1@dont-email.me> |
| In reply to | #2425 |
"GS" <gs@v.invalid> wrote | Found nothing on Peter Scale yet but I'm very interested in the resizing code | you use! | I think this is it: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=46515&lngWId=1 I'll try to pull together my code tomorrow and post it or post a link.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-29 13:22 -0400 |
| Message-ID | <r5qlh0$i52$1@dont-email.me> |
| In reply to | #2426 |
> "GS" <gs@v.invalid> wrote > >> Found nothing on Peter Scale yet but I'm very interested in the resizing >> code you use! >> > I think this is it: > > http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=46515&lngWId=1 > Got it; - will have a look-see shortly! Thanks... > I'll try to pull together my code tomorrow and > post it or post a link. That would be great! Big thanks for your interest! -- 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 | "Peter T" <askmy@email.com> |
|---|---|
| Date | 2020-03-30 17:29 +0100 |
| Message-ID | <r5t6q8$10v$1@dont-email.me> |
| In reply to | #2417 |
"GS" <gs@v.invalid> wrote in message > Hi All, > I've been searching for ideas on how to manage batch resizing of images in > a VB6.exe explorer app, I haven't been all through the thread so this might have already have been suggested - https://www.mvps.org/emorcillo/en/code/vb6/thumbnail.shtml I adapted it a long time ago for VBA in Excel to create thumbnails of all images in the supplied folder and show them on a form (in a column in a scrollable frame), click a thumbnail to show the full size image on the same form. For your purposes wouldn't need to show them, as StdPicture objects just 'SavePicture' back to file, obviously with a modified name if to same folder. Peter T
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-30 12:34 -0400 |
| Message-ID | <r5t735$3bm$1@dont-email.me> |
| In reply to | #2439 |
> "GS" <gs@v.invalid> wrote in message >> Hi All, >> I've been searching for ideas on how to manage batch resizing of images in >> a VB6.exe explorer app, > > I haven't been all through the thread so this might have already have been > suggested - > > https://www.mvps.org/emorcillo/en/code/vb6/thumbnail.shtml > > I adapted it a long time ago for VBA in Excel to create thumbnails of all > images in the supplied folder and show them on a form (in a column in a > scrollable frame), click a thumbnail to show the full size image on the same > form. For your purposes wouldn't need to show them, as StdPicture objects > just 'SavePicture' back to file, obviously with a modified name if to same > folder. > > Peter T Thanks Peter, I'll look at this too. I'll be doing all my testing in Excel14 anyway since I already have a project going for doing other related tasks! -- 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 | "Peter T" <askmy@email.com> |
|---|---|
| Date | 2020-03-31 10:59 +0100 |
| Message-ID | <r5v4ag$f2s$1@dont-email.me> |
| In reply to | #2440 |
"GS" <gs@v.invalid> wrote in message news:r5t735$3bm$1@dont-email.me... >> "GS" <gs@v.invalid> wrote in message >>> Hi All, >>> I've been searching for ideas on how to manage batch resizing of images >>> in a VB6.exe explorer app, >> >> I haven't been all through the thread so this might have already have >> been suggested - >> >> https://www.mvps.org/emorcillo/en/code/vb6/thumbnail.shtml >> >> I adapted it a long time ago for VBA in Excel to create thumbnails of all >> images in the supplied folder and show them on a form (in a column in a >> scrollable frame), click a thumbnail to show the full size image on the >> same form. For your purposes wouldn't need to show them, as StdPicture >> objects just 'SavePicture' back to file, obviously with a modified name >> if to same folder. >> >> Peter T > > Thanks Peter, I'll look at this too. I'll be doing all my testing in > Excel14 anyway since I already have a project going for doing other > related tasks! > I should have mentioned, if you just want the job done rather than the fun of doing it yourself, look at www.irfanview.com File / Batch Conversion/Rename / Advanced / Set long side to # (pixels, cm or inches) You'll probably want to tick preserve aspect ratio and resample, dozens more options on the advanced page, save with same date/time as the original is a nice touch. Back on the main page various ways to filter which images to process, and an 'include subfolders' option. I've been using IrfanView since last century and still find new things it can do, my all time favourite freeware app since ever, bar none! Hmm, I'm well overdue a top-up donation:) Peter T
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-31 09:43 -0400 |
| Message-ID | <r5vhei$9it$1@dont-email.me> |
| In reply to | #2450 |
> "GS" <gs@v.invalid> wrote in message news:r5t735$3bm$1@dont-email.me... >>> "GS" <gs@v.invalid> wrote in message >>>> Hi All, >>>> I've been searching for ideas on how to manage batch resizing of images >>>> in a VB6.exe explorer app, >>> >>> I haven't been all through the thread so this might have already have been >>> suggested - >>> >>> https://www.mvps.org/emorcillo/en/code/vb6/thumbnail.shtml >>> >>> I adapted it a long time ago for VBA in Excel to create thumbnails of all >>> images in the supplied folder and show them on a form (in a column in a >>> scrollable frame), click a thumbnail to show the full size image on the >>> same form. For your purposes wouldn't need to show them, as StdPicture >>> objects just 'SavePicture' back to file, obviously with a modified name if >>> to same folder. >>> >>> Peter T >> >> Thanks Peter, I'll look at this too. I'll be doing all my testing in >> Excel14 anyway since I already have a project going for doing other related >> tasks! >> > > I should have mentioned, if you just want the job done rather than the fun of > doing it yourself, look at www.irfanview.com > > File / Batch Conversion/Rename / Advanced / Set long side to # (pixels, cm or > inches) > You'll probably want to tick preserve aspect ratio and resample, dozens more > options on the advanced page, save with same date/time as the original is a > nice touch. > Back on the main page various ways to filter which images to process, and an > 'include subfolders' option. > > I've been using IrfanView since last century and still find new things it can > do, my all time favourite freeware app since ever, bar none! Hmm, I'm well > overdue a top-up donation:) > > Peter T I have it and so will play; - thank you very much! -- 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-31 12:53 -0400 |
| Message-ID | <r5vsi4$rnb$1@dont-email.me> |
| In reply to | #2450 |
> "GS" <gs@v.invalid> wrote in message news:r5t735$3bm$1@dont-email.me... >>> "GS" <gs@v.invalid> wrote in message >>>> Hi All, >>>> I've been searching for ideas on how to manage batch resizing of images >>>> in a VB6.exe explorer app, >>> >>> I haven't been all through the thread so this might have already have been >>> suggested - >>> >>> https://www.mvps.org/emorcillo/en/code/vb6/thumbnail.shtml >>> >>> I adapted it a long time ago for VBA in Excel to create thumbnails of all >>> images in the supplied folder and show them on a form (in a column in a >>> scrollable frame), click a thumbnail to show the full size image on the >>> same form. For your purposes wouldn't need to show them, as StdPicture >>> objects just 'SavePicture' back to file, obviously with a modified name if >>> to same folder. >>> >>> Peter T >> >> Thanks Peter, I'll look at this too. I'll be doing all my testing in >> Excel14 anyway since I already have a project going for doing other related >> tasks! >> > > I should have mentioned, if you just want the job done rather than the fun of > doing it yourself, look at www.irfanview.com > > File / Batch Conversion/Rename / Advanced / Set long side to # (pixels, cm or > inches) > You'll probably want to tick preserve aspect ratio and resample, dozens more > options on the advanced page, save with same date/time as the original is a > nice touch. > Back on the main page various ways to filter which images to process, and an > 'include subfolders' option. > > I've been using IrfanView since last century and still find new things it can > do, my all time favourite freeware app since ever, bar none! Hmm, I'm well > overdue a top-up donation:) > > Peter T BINGO! Big thanks, Peter! Don't know why I didn't do this already; - probably because I really don't use it much as I do MSO PictureManager. -- 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 18:20 -0400 |
| Message-ID | <r5trc0$qol$1@dont-email.me> |
| In reply to | #2417 |
Got to playing with different methods of resizing.
Hands down winner: GDI+ bicubic. Below is what you need. I'm afraid
it's in bits. One function opens a file and loads it, resizes, then
paints the bitmap. If you take the loading path and combine it
with the saving part from the second half of the second function,
you'll have a load, resize, save as JPG that's better than other
options. If you use bicubic (4 as interpolation mode) then you
get a beter image than bilinear in about the same time.
Public Enum gdiplusStatus '-- returned by gdip* methods
Ok = 0
GenericError = 1
InvalidParameter = 2
OutOfMemory = 3
ObjectBusy = 4
InsufficientBuffer = 5
NotImplemented = 6
Win32Error = 7
WrongState = 8
Aborted = 9
FileNotFound = 10
ValueOverflow = 11
AccessDenied = 12
UnknownImageFormat = 13
FontFamilyNotFound = 14
FontStyleNotFound = 15
NotTrueTypeFont = 16
UnsupportedGdiplusVersion = 17
GdiplusNotInitialized = 18
PropertyNotFound = 19
PropertyNotSupported = 20
ProfileNotFound = 21
End Enum
Private Type GdiplusStartupInput
GdiplusVersion As Long
DebugEventCallback As Long
SuppressBackgroundThread As Long
SuppressExternalCodecs As Long
End Type
Private Type RECTF
nLeft As Single
nTop As Single
nWidth As Single
nHeight As Single
End Type
Public Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(0 To 7) As Byte
End Type
Private Const UnitPixel As Long = 2
Public Enum InterpolationConstants
InterpolationModeDefault = 0
InterpolationModeLowQuality = 1
InterpolationModeHighQuality = 2
InterpolationModeBilinear = 3
InterpolationModeBicubic = 4
InterpolationModeNearestNeighbor = 5
InterpolationModeHighQualityBilinear = 6
InterpolationModeHighQualityBicubic = 7
End Enum
Private Declare Function GdiplusStartup Lib "GdiPlus" (token As Long,
inputbuf As GdiplusStartupInput, Optional ByVal outputbuf As Long = 0) As
Long
Private Declare Function GdipLoadImageFromFile Lib "GdiPlus.dll" (ByVal
mFilename As Long, ByRef mImage As Long) As Long
Private Declare Function GdipDeleteGraphics Lib "GdiPlus.dll" (ByVal
mGraphics As Long) As Long
Private Declare Function GdipCreateFromHDC Lib "GdiPlus" (ByVal hdc As Long,
hGraphics As Long) As Long
Private Declare Function GdipDisposeImage Lib "GdiPlus" (ByVal Image As
Long) As Long
Private Declare Sub GdiplusShutdown Lib "GdiPlus" (ByVal token As Long)
Private Declare Function GdipCreateBitmapFromHBITMAP Lib "GdiPlus.dll"
(ByVal hbm As Long, ByVal hPal As Long, ByRef pBitmap As Long) As Long
Private Declare Function GdipGetImageBounds Lib "GdiPlus.dll" (ByVal nImage
As Long, srcRect As RECTF, srcUnit As Long) As Long
Private Declare Function GdipSetInterpolationMode Lib "GdiPlus" (ByVal
hGraphics As Long, ByVal Interpolation As Long) As Long
Private Declare Function GdipDrawImageRectRectI Lib "GdiPlus" (ByVal
hGraphics As Long, ByVal hImage As Long _
, ByVal dstX As Long, ByVal dstY As Long, ByVal
dstWidth As Long, ByVal dstHeight As Long _
, ByVal SrcX As Long, ByVal SrcY As Long, ByVal
srcWidth As Long, ByVal srcHeight As Long _
, ByVal srcUnit As Long, Optional ByVal
imageAttributes As Long = 0 _
, Optional ByVal Callback As Long = 0, Optional
ByVal callbackData As Long = 0) As Long
Public Declare Function GdipSaveImageToFile Lib "GdiPlus" (ByVal Image As
Long, ByVal sFilePath As Long, clsidEncoder As GUID, encoderParams As Any)
As Long
'-- used with GDIP:
Public Declare Function CLSIDFromString Lib "ole32" (ByVal str As Long, id
As GUID) As Long
'--resize an image in proportion to original and paint.
Public Function ResizeAndPaintGDIP(FileName As String, DesthDC As Long,
DestW As Long, Interpolation As Long) As Long
Dim GDIsi As GdiplusStartupInput
Dim gToken As Long, hGraphics As Long, hBitmap As Long, LRet As Long
Dim ImRect As RECTF
Dim DestH As Long
On Error Resume Next
GDIsi.GdiplusVersion = 1&
LRet = GdiplusStartup(gToken, GDIsi)
If LRet <> 0 Then ResizeAndPaintGDIP = LRet: Exit Function
LRet = GdipCreateFromHDC(DesthDC, hGraphics)
If hGraphics <> 0 Then
LRet = GdipLoadImageFromFile(StrPtr(FileName), hBitmap)
If hBitmap <> 0 Then
LRet = GdipGetImageBounds(hBitmap, ImRect, UnitPixel)
LRet = GdipSetInterpolationMode(hGraphics, Interpolation)
DestH = CLng(ImRect.nHeight * (DestW / ImRect.nWidth))
LRet = GdipDrawImageRectRectI(hGraphics, hBitmap, 0, 0, DestW,
DestH, 0, 0, ImRect.nWidth, ImRect.nHeight, UnitPixel, 0&, 0&, 0&)
GdipDisposeImage hBitmap
ResizeAndPaintGDIP = LRet
End If
GdipDeleteGraphics hGraphics
End If
GdiplusShutdown gToken
End Function
Public Function WriteJPG(sPath As String, ByVal Quality As Long) As Long
'11-11
Dim hdc As Long, LRet As Long, LRet2 As Long
Dim hGDIPBitmap As Long 'handle to GDI+ bitmap.
Dim BBits() As Byte
Dim GUIDEncodeJPG As GUID
Dim EncodeParams As EncoderParameters
Const EncoderValueType As Long = &H4
On Error Resume Next
ReDim BBits(BMPInfo.bmiHeader.biHeight * BytesPerScanLine) As Byte
hdc = CreateCompatibleDC(0&)
LRet = GetDIBits(hdc, CurPic, 0, Abs(BMPInfo.bmiHeader.biHeight),
BBits(0), BMPInfo, DIB_RGB_COLORS)
LRet2 = DeleteDC(hdc)
If (LRet = 0) Then
WriteJPG = 1
Exit Function
End If
GdipCreateBitmapFromGdiDib BMPInfo, ByVal VarPtr(BBits(0)), hGDIPBitmap
If hGDIPBitmap <> 0 Then
CLSIDFromString StrPtr("{557CF401-1A04-11D3-9A73-0000F81EF32E}"),
GUIDEncodeJPG
' Initialize the encoder parameters
EncodeParams.Count = 1
With EncodeParams.Parameter ' Quality
CLSIDFromString
StrPtr("{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}"), .GUID
.NumberOfValues = 1
.Type = EncoderValueType
.Value = VarPtr(Quality)
End With
LRet = GdipSaveImageToFile(hGDIPBitmap, StrPtr(sPath),
GUIDEncodeJPG, EncodeParams)
GdipDisposeImage hGDIPBitmap ' Destroy the bitmap
Else
LRet = 2 'set error code.
End If
WriteJPG = LRet
End Function
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-30 18:50 -0400 |
| Message-ID | <r5tt3f$524$1@dont-email.me> |
| In reply to | #2443 |
Wow! I really appreciate your commitment to this! I'll need time to figure out what it's doing before I can start using it, though, since it's all 'Greek' to me. Not to mention so many variations of how-to with GDI+! "If you use bicubic (4 as interpolation mode) then you get a beter image than bilinear in about the same time." Does this mean I should also pass 7 for the Quality arg of WriteJPG? -- 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 18:56 -0400 |
| Message-ID | <r5ttfb$6qa$1@dont-email.me> |
| In reply to | #2443 |
> '--resize an image in proportion to original and paint. > Public Function ResizeAndPaintGDIP(FileName As String, DesthDC As Long, > DestW As Long, Interpolation As Long) As Long Do I assume that DesthDC and DestW are my target sizes? How would I know this prior to loading the image to find out existing size? (file details, perhaps?) -- 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 21:24 -0400 |
| Message-ID | <r5u64r$h5i$1@dont-email.me> |
| In reply to | #2445 |
"GS" <gs@v.invalid> wrote |> '--resize an image in proportion to original and paint. | > Public Function ResizeAndPaintGDIP(FileName As String, DesthDC As Long, | > DestW As Long, Interpolation As Long) As Long | | Do I assume that DesthDC and DestW are my target sizes? How would I know this | prior to loading the image to find out existing size? (file details, perhaps?) | No. DesthDC is destination DC. That's the handle for painting, which you don't want. Maybe I can clean this up, but I was doing it last minute today. (Now that I'm home all day I don't seem to have a minute to spare!) It's confusing because I had two functions. One is opening a file and doing a resized paint to a picturebox. The other is taking bitmap bits, getting an hBitmap handle from that, and using the handle to save a JPG to disk. So a lot of what you want is here but the middle step, resizing and ending up with an hBitmap, needs to be done differently. I'll try to work on it tomorrow.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-30 21:30 -0400 |
| Message-ID | <r5u6fl$4mj$1@dont-email.me> |
| In reply to | #2446 |
> "GS" <gs@v.invalid> wrote > >>> '--resize an image in proportion to original and paint. >>> Public Function ResizeAndPaintGDIP(FileName As String, DesthDC As Long, >>> DestW As Long, Interpolation As Long) As Long >> >> Do I assume that DesthDC and DestW are my target sizes? How would I know >> this prior to loading the image to find out existing size? (file details, >> perhaps?) >> > No. DesthDC is destination DC. That's the handle > for painting, which you don't want. Maybe I can clean this > up, but I was doing it last minute today. (Now that I'm > home all day I don't seem to have a minute to spare!) > > It's confusing because I had two functions. One is > opening a file and doing a resized paint to a picturebox. > The other is taking bitmap bits, getting an hBitmap > handle from that, and using the handle to save a JPG > to disk. > So a lot of what you want is here but the middle step, > resizing and ending up with an hBitmap, needs to be > done differently. I'll try to work on it tomorrow. Big thanks; - much appreciated! I'm working out getting file info via "Shell.Application"; - going 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 | "Mayayana" <mayayana@invalid.nospam> |
|---|---|
| Date | 2020-03-30 22:01 -0400 |
| Message-ID | <r5u8bu$src$1@dont-email.me> |
| In reply to | #2447 |
"GS" <gs@v.invalid> wrote | I'm working out getting file info via "Shell.Application"; - going well! | That happens to be another area of interest for me. I might have something useful from my explorer bar code.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-30 22:11 -0400 |
| Message-ID | <r5u8th$vk5$1@dont-email.me> |
| In reply to | #2448 |
> "GS" <gs@v.invalid> wrote > >> I'm working out getting file info via "Shell.Application"; - going well! >> > > That happens to be another area of interest for me. > I might have something useful from my explorer bar code. I have this part working well from another project that retrieves extended file properties via GetDetailsOf(). -- 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-31 17:41 -0400 |
| Message-ID | <r60ddq$m65$1@dont-email.me> |
| In reply to | #2417 |
Garry,
I spent most of the day fiddling with this, trying to
paste together old code without it taking a lot of
time. I just didn't want to get into mixing GDI and
GDI+ to make it work.
But here's another solution I came up with in a few
minutes. It's a button sub from a test program.
You need a reference to Windows Image Acquisition 2.
(It may need to be installed on XP. I don't remember.)
Then you need the button, a text box maned TTime,
and the declare. It will process a 10 MB JPG in about
1/3 second. In my other tests of painting an image it
wasn't quite as nice or quite as fast as GDI+, but it's
not far behind.
It might need a little work. One image kept erroring with
"the parameter is incorrect" on the ImProc.Apply line.
I don't know why. Others worked fine. A 12 MB image took
344 ms to load, resize, and save as a new file. Yet Irfan
View said it took 297 ms just to load the image. So I guess
344 isn't bad.
'------------------------------------------------
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Tick1 As Long, Tick2 As Long
Private Sub ButWIA2_Click()
Dim s1 As String
Dim W As Long, H As Long
Dim DestH As Long, DestW As Long, SrcW As Long, SrcH As Long, LSize As Long
Dim Img1 As ImageFile, Img2 As ImageFile
Dim ImProc As ImageProcess
TTime.Text = ""
Tick1 = GetTickCount
Set Img1 = New ImageFile
Set ImProc = New ImageProcess
Img1.LoadFile TPath.Text
LSize = 640
SrcW = Img1.Width
SrcH = Img1.Height
Debug.Print SrcW & " " & SrcH
If SrcW >= SrcH Then
DestW = LSize
DestH = SrcH * (DestW / SrcW)
Else
DestH = LSize
DestW = SrcW * (DestH / SrcH)
End If
While (ImProc.Filters.Count > 0)
ImProc.Filters.Remove 1
Wend
ImProc.Filters.Add ImProc.FilterInfos("Scale").FilterID
ImProc.Filters(1).Properties("MaximumWidth") = DestW
ImProc.Filters(1).Properties("MaximumHeight") = DestH
ImProc.Filters(1).Properties("PreserveAspectRatio") = True
Set Img1 = ImProc.Apply(Img1)
Dim s As String, Pt1 As Long
s = TPath.Text
Pt1 = InStrRev(s, ".")
s = Left$(s, (Pt1 - 1)) & "640.jpg"
Img1.SaveFile s
Set ImProc = Nothing
Set Img1 = Nothing
Tick2 = GetTickCount
TTime.Text = CStr(Tick2 - Tick1)
End Sub
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-31 17:51 -0400 |
| Message-ID | <r60e21$qb9$1@dont-email.me> |
| In reply to | #2453 |
Thank you so much for your time&effort; - I appreciate it immensely! Irfanview seems to be doing a much better job 'all-in-1-app' than anything I've tried so far. (800+ files in about 8 seconds) I'll spend time with your solution (once I've gained some lost ground here) so I can have my own custom feature[s]. -- 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-31 21:08 -0400 |
| Message-ID | <r60pj3$r6g$1@dont-email.me> |
| In reply to | #2454 |
"GS" <gs@v.invalid> wrote | Thank you so much for your time&effort; - I appreciate it immensely! | | Irfanview seems to be doing a much better job 'all-in-1-app' than anything I've | tried so far. (800+ files in about 8 seconds) | | I'll spend time with your solution (once I've gained some lost ground here) so | I can have my own custom feature[s]. | OK. I'll leave it at that. You probably can't beat Irfan View. It was nice to refresh my memory a bit, though. I've got free time lately but haven't had any interesting coding projects for awhile.
[toc] | [prev] | [next] | [standalone]
| From | GS <gs@v.invalid> |
|---|---|
| Date | 2020-03-31 21:14 -0400 |
| Message-ID | <r60pu1$sr8$1@dont-email.me> |
| In reply to | #2455 |
> "GS" <gs@v.invalid> wrote > >> Thank you so much for your time&effort; - I appreciate it immensely! >> >> Irfanview seems to be doing a much better job 'all-in-1-app' than anything >> I've tried so far. (800+ files in about 8 seconds) >> >> I'll spend time with your solution (once I've gained some lost ground here) >> so I can have my own custom feature[s]. >> > > OK. I'll leave it at that. You probably can't beat > Irfan View. It was nice to refresh my memory a bit, > though. I've got free time lately but haven't had > any interesting coding projects for awhile. Ah, and I have the interest but no time lately! -- 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] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.basic.visual.misc
csiph-web