Jump to content

shrink .bmp file


Recommended Posts

How could I shrink a .bmp file from autoit, without using external executables? (for example from 900kb to 100 kb or less)

Thx in advance.

Edited by darzanmihai

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Link to comment
Share on other sites

Incidentally, I did make a native 'wrapper' for Bitmaps which i recently updated- http://www.autoitscript.com/forum/index.php?showtopic=27362.

It does not provide a built in 'resize' function (if that's what you're after?), but it does give you functions to deal with the bitmap at the pixel level so you could implement any number of things to try and reduce the data size.

However, if you're looking at just reducing the file size, maybe you want to compress it with a standard file compressor instead?

Edited by evilertoaster
Link to comment
Share on other sites

Incidentally, I did make a native 'wrapper' for Bitmaps which i recently updated- http://www.autoitscript.com/forum/index.php?showtopic=27362.

It does not provide a built in 'resize' function (if that's what you're after?), but it does give you functions to deal with the bitmap at the pixel level so you could implement any number of things to try and reduce the data size.

However, if you're looking at just reducing the file size, maybe you want to compress it with a standard file compressor instead?

Very interesting functions. You could use it to create filters for images. Thx for sharing.

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Link to comment
Share on other sites

Look at _ScreenCapture_SaveImage() function definition and see how to set a JPG file's quality. You can save .bmp as .jpg and reduce it's quality, thus reducing it's size on disk.

I looked at it...it would be a realy good ideea, but I can't figure out how to use it to open a .bmp and get it's handle, set the image quality and save it as .jpg.

How could I open it and get the handle to use with the ScreenCapture functions?

Thx

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Link to comment
Share on other sites

#include <ScreenCapture.au3>

Local const $sFileBMP = @ScriptDir & "\Desktop.bmp"
Local Const $sFileJPG = @ScriptDir & "\Desktop.jpg"

_ScreenCapture_Capture($sFileBMP, 0, 0, -1, -1, False)
_GDIPlus_Startup()

Local $hImage = _GDIPlus_ImageLoadFromFile($sFileBMP)
_GDIPlus_ImageSaveToFile($hImage, $sFileJPG)

_GDIPlus_Shutdown()

You can then look in _ScreenCapture_SaveImage() to see how to play with the quality of the image, if it makes different.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...