From: mayayana on
I just found a very interesting sample
project:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=46515&ln
gWId=1

It has VB code for several types of resampling
and a very nice sample project to display them.


From: Mike Williams on
"Mike D Sutton" <EDais(a)mvps.org> wrote in message
news:e%23$nG%23PzGHA.772(a)TK2MSFTNGP05.phx.gbl...

> Under XP I'm getting a 24-bit DIB regardless of the display depth.

Are you using the exact code I posted, which loads a jpg file (not a bmp
file) into a StdPicture object using the VB LoadPicture function? At this
end if I do that I get a 24 bit bitmap in the StdPicture on an XP machine
running at full colour depth but I get a 16 bit bitmap on the same XP
machine running at 16 bit colour depth. If I first run the code with the
machine set to full colour and I then switch to 16 bit colour in Control
Panel without closing the VB test program I do still get a 24 bit bitmap,
but as soon as I close the VB program and reopen it (or restart the machine)
I get the 16 bit result. Can you check it again for me Mike? Perhaps others
here might like to check it as well? The code I'm using is shown below. In
the meantime, do you have any code that will reliably load a jpg into a
StdPicture obect while retaining its full 24 bit colour depth even on 16 bit
machines. If you do then I'd welcome a copy.

Mike Williams

Option Explicit
Private Declare Function GetObject Lib "gdi32" _
Alias "GetObjectA" (ByVal hObject As Long, _
ByVal nCount As Long, lpObject As Any) As Long
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type

Private Sub Command1_Click()
Dim p1 As StdPicture
Dim myBmp As BITMAP
Dim retval As Long
Set p1 = LoadPicture("c:\tulips.jpg")
retval = GetObject(p1.Handle, Len(myBmp), myBmp)
MsgBox myBmp.bmBitsPixel
LoadPicture
End Sub






From: Mike Williams on
"mayayana" <mayaXXyana1a(a)mindXXspring.com> wrote in message
news:OGBJg.936$v%4.63(a)newsread1.news.pas.earthlink.net...

> I just found a very interesting sample project:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=46515&lngWId=1

Now that is very interesting. And it is producing some excellent results.

Mike



From: Mike Williams on
.. . . by the way, I've just come across some "Jpeg to DIBSection" code on
VBAcelerator that appears to do the trick regarding loading jpeg into a
DIBSection. If you don't mind I'd still like your response to my previous
post though, because it appears that the VB LoadPicture function when
loading a jpg int a StdPicture object appears to be working differently on
your own XP machine that it does on mine.

Mike



From: mayayana on

> > I just found a very interesting sample project:
>
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=46515&ln
gWId=1
>
> Now that is very interesting. And it is producing some excellent results.

Yes, and it's very simple code. The FreeImage
help file (a 2MB PDF download) has a sample
showing the effect of greatly enlarging a small
image with different filters. From looking at that
and trying the Reconstructor demo it seems that a
"bicubic" resample is probably the best way to get
very good quality reasonably quick, and bilinear is
moderately good very quickly. I wonder how that
compares to whatever method is used in StretchBlt.