|
-
May 27th, 2006, 08:35 AM
#1
Thread Starter
Frenzied Member
how do you compress an image?
Is there a way I can compress an image in VB.NET? If someone can point me to a tutorial or anything useful that would be great.
-
May 27th, 2006, 08:40 AM
#2
Re: how do you compress an image?
 Originally Posted by System_Error
Is there a way I can compress an image in VB.NET? If someone can point me to a tutorial or anything useful that would be great.
Hi,
Here's a link about how to compress an Image;
http://msdn.microsoft.com/library/de...gecompress.asp
Hope it helps,
sparrow1
-
May 27th, 2006, 10:03 AM
#3
Thread Starter
Frenzied Member
Re: how do you compress an image?
Are you sure that's VB.NET?
-
May 27th, 2006, 10:20 AM
#4
Re: how do you compress an image?
 Originally Posted by System_Error
Are you sure that's VB.NET?
Hi,
sorry I put the wrong link into your thread.
Here's the one I should putted into your thread.
http://www.codeproject.com/cs/media/MPEGFunction.asp
Must be the better one.
Wkr,
sparrow1
-
May 27th, 2006, 01:33 PM
#5
Re: how do you compress an image?
Compress an image into what? From what initial type to what compressed type? Do you mean BMP to JPG, or what? A little more info would be needed in order to give a more precise and informative answer, as there are numerous image types...
-
May 27th, 2006, 01:57 PM
#6
Thread Starter
Frenzied Member
Re: how do you compress an image?
 Originally Posted by gigemboy
Compress an image into what? From what initial type to what compressed type? Do you mean BMP to JPG, or what? A little more info would be needed in order to give a more precise and informative answer, as there are numerous image types...
Like the quality of the image. If you have photoshop, before you save an image, you can select the 'quality' which reduces size or increases size.
That better?
-
May 27th, 2006, 02:32 PM
#7
Re: how do you compress an image?
But each file format would have its own compression scheme. I believe you are referring to JPEGs, which allows you to change the compression level. I had replied a while back in a post about a way to go about doing this, and found it in the thread link below:
http://www.vbforums.com/showthread.php?t=370585
The method should allow you to specify a number from 1-100 to specify the amount of compression/quality when saving images as JPEGs
-
May 28th, 2006, 04:35 AM
#8
Frenzied Member
Re: how do you compress an image?
yea i remeber this post, it was a good one by the way
-
Jun 3rd, 2006, 07:02 AM
#9
Thread Starter
Frenzied Member
Re: how do you compress an image?
Thanks gigem! Sorry for the late reply, but I've been really busy lately. I'm working with the comperssion right now and I have a few more questions.
The following like of code:
Code:
bAfter.Image.Save(output_location, jpegCodec, encoderParams)
Is there a way I can create a new bitmap with those parameters instead of saving it right away? (I want to provide a preview and the ability to select other options before saving).
I can't find any bitmap constructor that takes that parameter. (This will be previewed in a picturebox)
One more thing: If I have different image types and I want to compress them, then do I just change the following line?:
Code:
GetEncoderInfo("image/jpeg")
Thanks in advanced for any help you may give!
-
Jun 3rd, 2006, 11:56 AM
#10
Re: how do you compress an image?
No, that code was just for the JPEG codec. JPEG image types allow you to change the compression percentage. Other types do not allow this. BMP's are uncompressed, GIF's dont have "compression", just different pallettes I believe (2-bit, 4-bit, 8-bit, etc). Thats why I was saying that each image type would be different, because it would matter on the image type that you are trying to work on.
In regards to your question about giving a preview, you can just run the code, saving it to some temp file, then load that temp file right back into a picturebox to see the preview. Just a quick solution using the code provided...
Last edited by gigemboy; Jun 3rd, 2006 at 12:00 PM.
-
Jun 3rd, 2006, 05:32 PM
#11
Hyperactive Member
Re: how do you compress an image?
I have a bunch of images off a camera with HUGE resolution is there a way to change the resolution on all of them to say 800x600 thus reducing the image size from 2mbs to something around 100 kbs?
-
Jun 3rd, 2006, 09:05 PM
#12
Hyperactive Member
Re: how do you compress an image?
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
|