Jump to content
rajah

resize images to reduce size

Recommended Posts

rajah

hello

first sorry about my bad english

i'm working on a little project a couple weeks ago, and i'm stuck on a little problem

i'm noob in autoit soi hope that i can found a solution here

this is my code

#include <ScreenCapture.au3>
#include <FTPEx.au3>
$iQuality = 30
$slp = 5000
$random = Random (1,987654,1) ; generate a random file name


    $host = "host.something.com"
    $user = "username"
    $pass = "mypassword"
    $public = ""
    $folder = "livestream/images/"
    $open = _FTP_Open("MySQL Upload")
    $conn = _FTP_Connect($open, $host, $user, $pass, 0, 21)
    $select1 = @ScriptDir &"/" &$random&".jpg"
While 1
_ScreenCapture_SetJPGQuality ( $iQuality )
_ScreenCapture_Capture (@ScriptDir &"/" &$random&".jpg")
_FTP_FilePut($conn, $select1, $public & $folder & $random & ".jpg")
Sleep ($slp)
_FTP_FileDelete ($conn, $folder  & $random & ".jpg" )
FileDelete ( @ScriptDir &"\" &$random&".jpg")
WEnd

 

a simple code, i call it a live streaming

so, i can navigate to www.site.com/streaming.php and keep watching the images progress.

the problem here is i can't resize the pictures, and i have a big screen, so each frame is about 950kb

so the stream is extremly laggy !

even when i reduce the quality of the capture, i can't make it smaller

the question is

how can i resize images? i dont care if i lost the quality.

THANKS


I love to program, and if I ever lose that love, I will no longer be a programmer.

It will be a sad day.

Share this post


Link to post
Share on other sites
mikell

Have a look in the helpfile to _GDIPlus_ImageResize() and _GDIPlus_ImageSaveToFile()

  • Like 1

Share this post


Link to post
Share on other sites
rajah

already done

can't understand anything ... i'm noob bro, that code up there took me about 1 month lol

and i can't find the easy way to do it

why not  _ScreenCapture_SetReolution or something like that ? :(


I love to program, and if I ever lose that love, I will no longer be a programmer.

It will be a sad day.

Share this post


Link to post
Share on other sites
Melba23

rajah,

You have been reported for sending PMs asking for help. Please read the Forum rules when you log back into the forum - you will see that we do not permit that here.

Asking for help via PM is discouraged because the forum is here to help everyone - if you get private help then no-one else can benefit.

So please do not do it again - just post in the forum and someone will help you.

M23

 

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
mikell

Here is a simple example of resizing an image and save it to file

#include <ScreenCapture.au3>

$iQuality = 30
$random = Random (1,987654,1) ; generate a random file name
Local Const $iW = @DesktopWidth, $iH = @DesktopHeight

_ScreenCapture_SetJPGQuality($iQuality)
$hCapture = _ScreenCapture_Capture()

_GDIPlus_Startup()
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hCapture)
$hImage2 = _GDIPlus_ImageResize($hImage1, $iW / 2, $iH / 2)
_GDIPlus_ImageSaveToFile($hImage2, @ScriptDir &"/" &$random&".jpg")

_WinAPI_DeleteObject($hCapture)
_GDIPlus_ImageDispose($hImage1)
_GDIPlus_ImageDispose($hImage2)
 _GDIPlus_Shutdown()

 

Share this post


Link to post
Share on other sites
rajah

Melba23

Sorry bro, i will read the rules right now :)

mikell

thanks bro, that was a great solution

that's exactly what i was looking for

+1

Edited by rajah
small mistake

I love to program, and if I ever lose that love, I will no longer be a programmer.

It will be a sad day.

Share this post


Link to post
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

×