|
-
Jul 6th, 2000, 12:13 AM
#1
Thread Starter
Hyperactive Member
Should be easy right? It probably is but i cant seem to get it right. I can save a picture to a bmp through a picture box, but the quality gets decreased a LOT. Is there anyone that knows how to get a BMP without the degradation??
Are there any shareware/freeware OCX files out there that aren't huge, that i could try?
BW
[Edited by But_Why on 07-06-2000 at 01:17 AM]
-
Jul 6th, 2000, 01:01 AM
#2
Hyperactive Member
Clarify
Firstly, you could go to http://vb-accelerator.com where i found excellent code on loading/saving JPEGs. This in turn "taught" me alot about device independant bitmaps.
What I wonder about your problem is how did the picture get to into the picture box in the first place? Was it loaded with LoadPicture? Drawn within code perhaps? Or was it bitblt's there? The answer to this might help determine what causes your loss of image quality.
While you're at it, you might advise what app you try to view the saved image in. If all else fails, try reducing your code to a simple piece of example code that you could post and someone can try it out.
I've done plenty of saving bitmaps and I have only ever had a problem when using bitblt and stretchblt where the quality on screen looks fine but once saved and reloaded, it looks like crap. This ended up being related to the state of the StretchBlt Mode (see SetStretchBlt) which was obviously being left in a bad state in another part of my app.
The effect I got was one of extremely bad pixelation (is that the right term?).
Hope it helps
Regards
Paul Lewis
-
Jul 6th, 2000, 03:43 PM
#3
Thread Starter
Hyperactive Member
Yeah i'd say thats the right term
All i'm doing is a small little program to make any picture the background wallpaper (yeah i know pretty lame but its all part of a master plan, hehehe). Now all that works sweet as. No problems there, except the final bmp. The way i'm currently getting the bmps is to loadpicture into a picturebox, and then savepicture as a bmp. I'm not stretching the bmp in any way (yet) and i'm not shrinking it either.
Is there a better way to get the end result? have i missed something important?
And yes pixelation is definately the right term, i get a lot of it with the loadpicture/savepicture combination.
Thanks for the reply
BW 
BTW that link you entered came up with
The requested URL could not be retrieved
DNS Domain 'vb-accelerator.com' is invalid: Host not found (authoritative). Could you check and re-post it.
-
Jul 6th, 2000, 03:55 PM
#4
-
Jul 6th, 2000, 04:00 PM
#5
Thread Starter
Hyperactive Member
Cheers Megatron
Thanks for that, thought it might have been something simple like.
-
Jul 6th, 2000, 04:25 PM
#6
Hyperactive Member
LoadPicture...SavePicture?
Tha can't be "all you are doing" otherwise there would seem to be no point at all.
I seriously can't duplicate this using only Save and Load Picture. Unless someone else can see a reason, I would have to start assuming it to be a non-code problem (i.e. something else in your setup).
However, just because I can't duplicate it doesn't mean you can't duplicate it, so if you did write an app that simplified the root problem, and if you posted it here, we could take a look at duplicating it.
Sorry I might have wasted your time... Hope it works out
Paul Lewis
-
Jul 6th, 2000, 04:37 PM
#7
Thread Starter
Hyperactive Member
hmmm...
PaulLewis: Nah you've missed it. Whats happening is, i select a picture file (generally a jpg), which then is converted to a bmp using Loadpicture/savepicture. then the bmp is used as the wallpaper of my desktop.
Code:
Set Picture1.Picture = LoadPicture(thefname)
SavePicture Picture1, Buff & "\tmpbmp.bmp"
FileName = Buff & "\tmpbmp.bmp"
X = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, FileName, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
Make sense now?
BW
-
Jul 6th, 2000, 04:50 PM
#8
Fanatic Member
Have you tried an Image control yet?
Chemically Formulated As:
Dr. Nitro
-
Jul 6th, 2000, 04:57 PM
#9
Thread Starter
Hyperactive Member
Can you SavePicture with an image?
I think i have it. The problem with savepicture is it saves to the colour depth of the screen, NOT to the colour depth of the original picture. I have my colour depth set to 16 bit, and the pictures are true colour.
Now just to work around that without changing my colour depth...
BW
-
Jul 6th, 2000, 05:40 PM
#10
Thread Starter
Hyperactive Member
Ok new question
How can i load a picture into a picturebox without using Loadpicture. Thats where i'm losing the quality right there. I loaded a picture in, and bam... PaulLewis's "Pixelation" occurs.
Damn...
Think i might start a new topic for this question.
Will add link to this message.
BW 
Heres the link
http://forums.vb-world.net/showthrea...threadid=21946
[Edited by But_Why on 07-06-2000 at 06:45 PM]
-
Jul 6th, 2000, 05:46 PM
#11
Hyperactive Member
Meanwhile
Meanwhile, with that code snippet you posted I cannot duplicate the problem (as you point out, the original image has alot to do with this) and not only that, I cannot get my machine to change the wallpaper to the new bmp.
It clears the wallpaper though, and when I manually select the newly saved bmp, it looks just like the original.
BMP format probably specifies the maximum colour depth - not that I've ever tried to find out... To help (sort of) with your workaround, you will might have to consider loading the image into a cDIBSection (see that vbaccelerator site for info), then change the header info to reduce the colour depth... Sounds like a whole lot of work so that makes me think a guru will know a faster way..
I'd be interested to hear how you get on...
Paul Lewis
-
Jul 6th, 2000, 05:57 PM
#12
Thread Starter
Hyperactive Member
My guess as to your problem with changing the wallpaper is the filename you are using to change the picture has spaces in it? or has more than 8 characters in it? That would cause what you have come up with.
If not let me know i can sort that out.
OK i have pictures that are 800x600x16M colors. I guess thats more than the picture box can handle because when i load the picture into the picture box, low and behold there is the Pixellation.
BW
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
|