Solved

Reducing bitmap size

Posted on 2001-06-23
4
669 Views
Last Modified: 2007-12-19
Hi currently I'm using Api to capture my scree. Then coe is below:
'Api to Sent Keyboard Events
'I shall use this to sent the "Print Screen " Key which will store the Screen in the clipboard
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As
Long, ByVal dwExtraInfo As Long)
Public Function SaveScreen(ByVal SaveFilePath As String) As Boolean
Call keybd_event(vbKeySnapshot, 1, 0, 0) 'Emulate The PrintScreen Key.
SavePicture Clipboard.GetData(vbCFBitmap), SaveFilePath
End Function
'This code was done with reference to 'http://www.planet-source-code.com/xq/ASP/txtCodeId.1621/lngWId.1/qx/vb/scripts/ShowCode.htm
I run the function and say the file to %systemdir\screenshot.bmp
Now the problem is this. I find the .Bmp file very big.
The above code save the bmp as 24-bit bitmap i think. How do i reduce the resolution? I would like to
reduce it to 16-Bit bitmap if possible. And is it possible to save the screen as .gif or .jpg?
The main Reson in doing this is to reduce the size of the file to as small as possible. Any other suggestions?
I've seen many code that claims to be able to either convert it to 256 color or change it to jpg format.  PRoblem is that all the codes are too complicated. I do not understand them...I'm very much open to suggestion
         
Thanks,
0
Comment
Question by:nexzus
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
glass_cookie earned 100 total points
Comment Utility
Oh, here's a link for you:

Download...
http://www.planetsourcecode.com/upload/ftp/CODE_UPLOAD8599842000.zip

Description: This is a dll I wrote. You can get desktop(in bmp or jpg), You can convert BMPtoJPG or JPGtoBMP, You can RotateLeft, RotateRight and You can make Grayscale a picture with it. I have included the dll Source code. Enjoy

That's it!

glass cookie : )
0
 

Author Comment

by:nexzus
Comment Utility
thanks a lot dude
0
 
LVL 8

Expert Comment

by:glass_cookie
Comment Utility
You're welcome : )
0
 

Expert Comment

by:ralan2
Comment Utility
The page referenced above is gone.  Can someone post the code here.  I need to obtain the height and width of a bitmap created in VB using the old GDI API.

Thanks,

ralan2
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now