Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Shrink an image to a thumbnail?

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
ChiefGoFor Posted - Nov 25 2004 : 09:43:07 AM
Hello All,
I am attempting to shrink an image down to a thumbnail, but when I do, I lose quality. The result just looks like crap. Does anyone know Algorithm I should use? Also, do you know where I could find a sample of the code to test? Thanks a lot!

Kenneth
AIM: ChiefGoFor
5   L A T E S T    R E P L I E S    (Newest First)
DevlinSE Posted - Nov 29 2004 : 04:15:06 AM
quote:
Originally posted by Brykovian

"StretchBlt" does all kinds of resizing ... even though it's called *stretch*, it will shrink just as well. Otherwise, you're left with having to do pixel-by-pixel averaging, like Sr. Guapo suggested.

-Bryk



Yeah, what he said.

But bicubic and bilinear still looks better, I can't find any code thought.
I just found a bicubic sample source which only literally "Stretches" an image from PSCode.
Maybe you can reverse it to do shrinking
Brykovian Posted - Nov 28 2004 : 8:12:34 PM
"StretchBlt" does all kinds of resizing ... even though it's called *stretch*, it will shrink just as well. Otherwise, you're left with having to do pixel-by-pixel averaging, like Sr. Guapo suggested.

-Bryk
ChiefGoFor Posted - Nov 25 2004 : 11:18:16 PM
I'm not stretching it, I am shrinking it. I was thinking using some kind of "Bicubic" algorithm. Anythoughts?!?!?!

Kenneth Crowder
AIM: ChiefGoFor
DevlinSE Posted - Nov 25 2004 : 4:05:46 PM
I'm don't know if there is a way to shrink/stretch an image without distorting it very much. But if you're not stretching it too much and not using it in DX you can try using StretchBlit api:

Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

Anyway, that's what I used for my crummy mapeditor . It's not so bad...I think.

More info and Examples @ API Guide

Sr. Guapo Posted - Nov 25 2004 : 11:39:55 AM
How are you doing it now? The easiet way I could think of is to just average all of the pixels in a square (of however many pixels), then use that as one pixel in the thumbnail.


VBGamer © Go To Top Of Page
This page was generated in 0.08 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.