PDA

Click to See Complete Forum and Search --> : Generating Thumbnails


amitabh
Dec 19th, 2000, 11:42 PM
Is there any special API/functions for generating thumbnails or everybody uses StrechBlt/PaintPicture for doing so?

kedaman
Dec 20th, 2000, 03:04 AM
There isn't any difference, thumbnails are resized

Fox
Dec 22nd, 2000, 11:53 AM
Only thing you can do is anti-aliasing to save quality...

Jotaf98
Dec 26th, 2000, 10:11 AM
Here's some code I found to interpolate an image:



For y = 0 To Pic.Height Step ((Pic.Height / Resized.Height) * 15) - 1
For x = 0 To Pic.Width Step ((Pic.Width / Resized.Width) * 15) - 1
Dim cRed, cBlue, cGreen
For sX = x To (x + ((Pic.Width / Resized.Width) * 15)) Step 15
For sY = y To (y + ((Pic.Height / Resized.Height) * 15)) Step 15
RGBfromLONG (GetPixel(Pic.hdc, sX / 15, sY / 15))
cRed = (cRed + rRed) / 2
cBlue = (cBlue + rBlue) / 2
cGreen = (cGreen + rGreen) / 2
Next sY
Next sX
SetPixel Resized.hdc, rX / 15, rY / 15, RGB(cRed, cGreen, cBlue)
rX = rX + 15
Next x

rY = rY + 15
rX = 0
Next y

Resized.Refresh


Now the function RGBFromLong:



Private Function RGBfromLONG(LongCol As Long)
'Get The Red, Blue And Green Values Of A Colour From The Long Value

rRed = LongCol And 255
rGreen = (LongCol And 65280) \ 256
rBlue = (LongCol And 16711680) \ 65535
End Function



Oh, there's 3 more variables you must declare (in the Declarations part of the code, before all the other functions) :



Dim rRed As Byte
Dim rBlue As Byte
Dim rGreen As Byte



That's it. Make sure you have the SetPixel and GetPixel APIs declared. The original image is Pic and the resized image is Resized. Sorry for having no comments, but that's how I found the function. And if it doesn't work, reply back, because I haven't tested it!

amitabh
Dec 27th, 2000, 02:01 AM
I am sory to ask this question again, but I still have no answer for this one:

Have any one of you ever tried using PaintPicture or StrechBlt on a child window. I cannot seem to make it work when I call it in the form resize event. The child window and the Mdi window are from two different applications. I am setting the child window to its mdi parent through a api call. If you can't understand the question, please post a message so that I can calrify further.

amitabh
Dec 27th, 2000, 08:51 AM
Oops!
Sorry for the trouble, but it was a simple case of setting the autoredraw property to true.

Sorry again