|
-
Jan 31st, 2002, 03:34 AM
#1
Thread Starter
Member
Image resize with out distortion
Hi there,
When i am resizing a picture on the picture box control the picture is getting distorted or pixelated.n How do i resize the image without distortion.
thanks
-
Jan 31st, 2002, 04:19 AM
#2
PowerPoster
use this API call before resizing the picture:
VB Code:
Private Const HALFTONE = 4
Private Declare Function SetStretchBltMode Lib "gdi32" (ByVal hdc As Long, ByVal nStretchMode As Long)
'use
SetStretchBltMode picHdc, HALFTONE
-
Jan 31st, 2002, 04:58 AM
#3
Thread Starter
Member
halftone is not supported in 95/98
-
Jan 31st, 2002, 08:38 AM
#4
PowerPoster
Try this
Private Const COLORONCOLOR = 3
-
Jan 31st, 2002, 04:14 PM
#5
Good Ol' Platypus
You can also try a bicubic/bilinear resize algorithm.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 4th, 2002, 02:16 AM
#6
Addicted Member
Sastraxi
Could you help me regarding the Bicubic/Bilinear resizing algorithm and how do i implement it in VB. Or may you could suggest some sites where i can get the information.
Fact is i need to include the image resizing in one of my modules. But the resultant image i got is being pixelated. I'm using the paintpicture method of the picture box.
I'm also in a lookout for resing the images using the code. I've tried also using the stretchblt API call but hte result seems to be the same.
Thanx in advance
Cute Member 
-
Feb 4th, 2002, 08:37 AM
#7
Good Ol' Platypus
I recommend getting the book Visual Basic Graphics programming. There are two functions you use, one for enlarging and one for shrinking, and you'll have to adapt it to your own code. Try searching google if you don't have this book for Resize Algorithm.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 5th, 2002, 07:13 AM
#8
Addicted Member
-
Feb 5th, 2002, 08:27 AM
#9
Good Ol' Platypus
I have the code in my book but really don't have the time to write it out... sorry.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 7th, 2002, 02:08 PM
#10
Strictly speaking, it is impossible to resize an image without distorting it, the trick is to distort it as little as possible, but its never going to be perfect.
Firstly, if you're resizing by a large amount, particularly if you're expanding an image it will look pixellated and crappy. Even a decent bicubic algorithm (say for example Photoshop's) won't be able to fix it if you're trying to make it really big.
Secondly, try to resize to a common factor or multiple of the images original size. shrinking an image to 50% will look better than shrinking it to 66.6% for example.
The whole subject is quite a complicated science. A google search could tell you more.
-
Feb 7th, 2002, 03:55 PM
#11
Good Ol' Platypus
Learning the mechanics behind it will help you best manipulate it; don't jump straight in to code.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 9th, 2002, 06:45 PM
#12
Addicted Member
Fury2GE has Bi-Linear resampling, but the down-scaling is buggy. If you don't mind using a library, mine does it quite fast (in realtime, literally, for sizes below 640x480.)
http://fury2.happyapathy.com/fury2ge.exe
"1 4m 4 1337 #4xz0r!'
Janus
-
Mar 5th, 2002, 05:45 AM
#13
Addicted Member
-
Mar 5th, 2002, 09:52 PM
#14
Addicted Member
A non-zero return code means an error, you should look up the return code in the MSDN documentation for StretchBlt.
"1 4m 4 1337 #4xz0r!'
Janus
-
Mar 6th, 2002, 02:16 AM
#15
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|