Jump to content

resize images to reduce size


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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()

 

Link to comment
Share on other sites

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.

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