Jump to content

Recommended Posts

Posted (edited)

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.

Posted (edited)

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
Posted

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.

Posted

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.

Posted

#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.

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
  • Recently Browsing   0 members

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