Sign in to follow this  
Followers 0
wakillon

Html-Imager Update of 17 Dec 2014

28 posts in this topic

#1 ·  Posted (edited)

2016020320555060os6.jpg

A simple script for generate a Html file with Images and some few features.

As usual external files and includes are embedded.

Compatible with AutoIt Versions 3.3.8.1 to 3.3.13.19

ChangeLog v 1.0.1.3

You can now Add/Manage Prev/Next/Home/Top/Bottom Page Links from Gui Menu.

 

Previous downloads : 111

Downloads available in the download section

 

Hope this example can be useful to someone !  :)

Edited by wakillon
3 people like this

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Heya wakillon, any chance you could post the code without stripping it down? (with just the includes)

That makes for a lot of code to look through.

Edit:

This is just a request, no have toos!

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi SmOke_N

No problem you can get it here 

There are still more than 1500 lines to read !  :D

And it's only compatible with the last release.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Thanks, I'll dig through that "short" ;) code in a bit :).


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

All my apologies, finalizing the code, i have created a bug.

Fixed version uploaded. :sweating:


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I selected a folder with 980 pictures and it took several minutes to load all those pictures.

  1. Can you try to speed it up?
  2. An abort feature would be great
  3. Double click on a picture will open the picture in e.g. default app or you display it
  4. How about a cool JS About intro? ;)

The last 4 pictures have no preview image in listview.

 

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I selected a folder with 980 pictures and it took several minutes to load all those pictures.

  1. Can you try to speed it up?
  2. An abort feature would be great
  3. Double click on a picture will open the picture in e.g. default app or you display it
  4. How about a cool JS About intro? ;)

The last 4 pictures have no preview image in listview.

 

Br,

UEZ

 

Hi UEZ !

1 no cause cpu usage will be too high

2 yes it can be added

3 yes it can be added too

4 What's that "JS About intro" ?

Thumbs in listview are loaded in memory for be resized with GDI functions, so may be the images count you have tried to load is a bit excessive... :P

Take a look to your CPU usage at the same time...

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hi UEZ !

1 no cause cpu usage will be too high

2 yes it can be added

3 yes it can be added too

4 What's that "JS About intro" ?

Thumbs in listview are loaded in memory for be resized with GDI functions, so may be the images count you have tried to load is a bit excessive... :P

Take a look to your CPU usage at the same time...

 

Regarding 1 (never say never ;)):

I reduced the time from 166s to 66s using this modification of the function _GUICtrlListView_AdaptImage():

Func _GUICtrlListView_AdaptImage ( $hListView, $hImageList, $iIndex, $sFilePath, $iImageSize=128 )
    If Not FileExists ( $sFilePath ) Then Return SetError ( 1, 0, 0 )
    Local $hBitmap = _GDIPlus_BitmapCreateFromFile ( $sFilePath )
    Local $iNewWidth, $iNewHeight, $hBitmap_Scaled1, $hBitmap_Scaled2, $hGraphic, $iRatio
    Local $iWidth = _GDIPlus_ImageGetWidth ( $hBitmap )
    Local $iHeight = _GDIPlus_ImageGetHeight ( $hBitmap )
    ; keep ratio.
    If $iWidth >= $iHeight Then ; square or horizontal image.
        $iRatio = $iHeight/$iWidth
        $iNewWidth = $iImageSize
        $iNewHeight = Int ( $iImageSize * $iRatio )
    Else ; vertical image.
        $iRatio = $iWidth/$iHeight
        $iNewWidth = Int ( $iImageSize * $iRatio )
        $iNewHeight = $iImageSize
    EndIf
    $hBitmap_Scaled2 = _GDIPlus_BitmapCreateFromScan0($iImageSize, $iImageSize) ; _GDIPlus_ImageResizeEx ( $hBitmap, $iImageSize, $iImageSize )
    $hGraphic = _GDIPlus_ImageGetGraphicsContext ( $hBitmap_Scaled2 )
    _GDIPlus_GraphicsDrawImageRectRect ( $hGraphic, $hBitmap, _
        0, _
        0, _
        $iWidth, _
        $iHeight, _
        0, _
        0, _
        $iNewWidth, _
        $iNewHeight )
    Local $hImageBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hBitmap_Scaled2 )
    _GUIImageList_Add ( $hImageList, $hImageBMP )
    _WinAPI_DeleteObject ( $hImageBMP )
    _GDIPlus_GraphicsDispose ( $hGraphic )
    _GDIPlus_BitmapDispose ( $hBitmap_Scaled2 )
    _GDIPlus_BitmapDispose ( $hBitmap )
    _GUICtrlListView_AddItem ( $hListView, '', $iIndex )
EndFunc ;==> _GUICtrlListView_AdaptImage()

and removed the Sleep(10) from some of the functions.

 

Regarding 4:

You create a html for your About section. It would be cool to add some JavaScript effects, at least I would do it.  :D

 

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

wakillon

Good work, thanks for sharing.

 

mLipok


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Thanks for sharing!


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

UEZ 

1) You have not understood all the utility of this function

it allows to create a thumbnails, yes , but it also allows this thumbnails to be displayed centered in his listview item.
Your modifications remove this functionality ! 
 
Why do you think i have added some "Sleep(10)" in each loops ?
 
I have tried with 1520 images in 178 sec ( so it need 0,11 sec for create each thumbnails)
CPU was about 20% and memory consumption was about 210000 K
So, It's already high !
If i remove all the "Sleep(10)", and test in the same conditions, yes it's a bit more fast, but my CPU rises above 25%
 
Increase the speed of execution is a good thing in itself, but you need to count the resources used too!  ;)
(am I speaking as an ecologist ?  :D)
 
4) Working on this script about HTML, I thought it was tasteful to have an "About" in HTML too, but my knowledges about it, is limited !  :P
But you know that javascript is not my cup of tea and I seem to remember that it was your case too ! no ?  :)
 
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

I didn't catch the center feature but that shouldn't hard to add:

Func _GUICtrlListView_AdaptImage ( $hListView, $hImageList, $iIndex, $sFilePath, $iImageSize=128 )
    If Not FileExists ( $sFilePath ) Then Return SetError ( 1, 0, 0 )
    Local $hBitmap = _GDIPlus_BitmapCreateFromFile ( $sFilePath )
    Local $iNewWidth, $iNewHeight, $hBitmap_Scaled1, $hBitmap_Scaled2, $hGraphic, $iRatio
    Local $iWidth = _GDIPlus_ImageGetWidth ( $hBitmap )
    Local $iHeight = _GDIPlus_ImageGetHeight ( $hBitmap )
    ; keep ratio.
    If $iWidth >= $iHeight Then ; square or horizontal image.
        $iRatio = $iHeight/$iWidth
        $iNewWidth = $iImageSize
        $iNewHeight = Int ( $iImageSize * $iRatio )
    Else ; vertical image.
        $iRatio = $iWidth/$iHeight
        $iNewWidth = Int ( $iImageSize * $iRatio )
        $iNewHeight = $iImageSize
    EndIf
    $hBitmap_Scaled2 = _GDIPlus_BitmapCreateFromScan0($iImageSize, $iImageSize) ; _GDIPlus_ImageResizeEx ( $hBitmap, $iImageSize, $iImageSize )
    $hGraphic = _GDIPlus_ImageGetGraphicsContext ( $hBitmap_Scaled2 )
    If $iWidth < $iImageSize And $iHeight < $iImageSize Then
        _GDIPlus_GraphicsDrawImageRect( $hGraphic, $hBitmap, ($iImageSize - $iWidth) / 2, ($iImageSize - $iHeight) / 2, $iWidth, $iHeight)
    Else
        _GDIPlus_GraphicsDrawImageRectRect ( $hGraphic, $hBitmap, _
            0, _
            0, _
            $iWidth, _
            $iHeight, _
            ($iImageSize - $iNewWidth) / 2, _
            ($iImageSize - $iNewHeight) / 2, _
            $iNewWidth, _
            $iNewHeight )
    EndIf
    Local $hImageBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hBitmap_Scaled2 )
    _GUIImageList_Add ( $hImageList, $hImageBMP )
    _WinAPI_DeleteObject ( $hImageBMP )
    _GDIPlus_GraphicsDispose ( $hGraphic )
    _GDIPlus_BitmapDispose ( $hBitmap_Scaled2 )
    _GDIPlus_BitmapDispose ( $hBitmap )
    _GUICtrlListView_AddItem ( $hListView, '', $iIndex )
EndFunc ;==> _GUICtrlListView_AdaptImage()

Imho, it doesn't matter whether the CPU usage is at 25% or 20% because it is for a limited of a time.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Imho, it doesn't matter whether the CPU usage is at 25% or 20% because it is for a limited of a time.

 

Depends if you are doing something else at the same time...

Your last modification is better, but do i need to consider that your new _GDIPlus_ImageResize function is too slow ?  :D

And for javascript all i have made is >here (be patient it's a bit slow to start)

:)


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Well, when you call _GDIPlus_GraphicsDrawImageRect* twice or more times it is slower than when you call it only once regardless whether _GDIPlus_GraphicsDrawImageRect* are slow functions...

Regarding the CPU usage. 25% usage means you have 4 cores and one is busy with you script. The other 3 cores are idle and waiting for some "work".

If you need some cool JS stuff have a look here: http://js1k.com/

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

Updated

Suggestions :

1) 50% done

2) done

3) done

4) may be...


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

The counting of the images seems not to work properly. After all 979 images are loaded the "current selection" is 1/979 although all thumbs are selected (as seen on your screenshot).

Selecting / unselecting count seems also not to work.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

The counting of the images seems not to work properly. After all 979 images are loaded the "current selection" is 1/979 although all thumbs are selected.

Selecting / unselecting count seems also not to work.

Br,

UEZ

 

I just load 1520 images without any problems

And multi select should not be possible as listview use $LVS_SINGLESEL style.

I can't reproduce your error...

Edit : if there is no selection, the selection label is empty. 

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Ok, I understood the "Current Selection" differently. I thought it is the count of all checked thumbs but it shows the position of the current selection only.

Sorry.

The JS (rotating balls) is very nice  :thumbsup: . Can you bring them behind the text?

Br,
UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

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
Sign in to follow this  
Followers 0

  • Similar Content

    • SimTheNo1
      By SimTheNo1
      I am busy with building a solution for change monitoring of VOIP call program and to be properly automated means among others need for some limited OCR functionality. Current works of others are way too much overkill for this case what makes the need to build it myself. But to do it properly I significantly have to increase my knowledge about digital graphics management.
      For now I already have discovered here and there some mind blowing  Autoit miracles what can be achieved with Windows own possibilities to manipulate that what is output to the monitor. And as far I can judge there are 2 options to process graphics without use of any external libraries like ImageMagick, FreeImage and so on. These are:
       WinAPI  GDIPlus It is for me quite obvious to have various holes in general understanding of graphics and it is once more very clear what advantages gives consistent general study in 1 or another official institutions like University.  Cause there you are introduced into certain domain of knowledge in a way which usually has been perfected over long period of time. So you are not overloaded by stuff which requires a certain amount of information to be initially clear for you. For example, before starting to solve physics you first learn to read, count and so on and then move to subjects like physics.
      Though in my case opportunity to study in such educational system I had only for 8 years, from my 7th to 15th year of age in the country that was falling apart now Ukraine but used to be USSR, was all what it was. After have immigrated to Netherlands possibilities to study further haven't occur. And this therefor causes often various implications when going deep in that or another field of practical knowledge acquiring for any needed physical result, like programming to perform enormous amount of tasks. In this particular case automating VOIP call program.
      Anyway, right now I think the best direction to move is to concentrate on as basic as possible image management and if someone would maybe explain in general what is a pixel will definitely help. Particularly I am very curious about how to do picture manipulations in Autoit. Especially would help a lot to produce eventually following functions:
      createImage($imageFileName, $width, $height, $color) readImagePixel($imageFileName, $x, $y)  writeImagePixel($imageFileName, $x, $y) I do not know exactly how image is handled in computer but preferably above mentioned functions should deal with so far possible origin of graphics creation on computer. But nevertheless I definitely would love to hear any proposition for solution.
      The problem with explaining screenshots:
       VOIPConnect full Window  Part of Window with control to monitor for changes  Exact location of area where actual changes occur and have to be processed  It comes down to a rectangle of approximately 51 pixel wide and 7 pixel high. In fact if I get to learn as far as to be able exactly read, write and compare 2 images consistently across different computers I could narrow down then even further the area to watch as little as a square of 2-5 pixels wide. 
      To finish here is last detail about particularly no need for ultra fast solution at all. This because it is needed only once when it is first run on a new computer and to have to wait few minutes while it is being set instead of just a few seconds make no sence.
      This is it and what I too think to do beside this very particular case is to purify out beautiful generic Autoit functions for core image manipulation by using WinAPI or/and GDIPlus. 
    • Ian_Mac
      By Ian_Mac
      Func dg_get_images() $x1=0 $y1=0 ;MsgBox(0,"start","start") do $result = _ImageSearch("C:\Users\Server\Desktop\my project\image.png",1,$x1,$y1,0) until $result = 1; if $result=1 Then MouseMove($x1,$y1,3) MouseClick("left", $x1,$y1, 1) WinWait("[Title:TightVNC File Transfer]", "", 10) EndIf  this code works when i search the image, but when i change the location of the desktop icon it can't find the desktop icon anymore.   i wanna try image search area. but i don't know how to use it because i cant understand the parameter for the image search area.  please help me how to solve it thank you in advance.
    • SkysLastChance
      By SkysLastChance
      #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("website") Local $oForms = _IEFormGetCollection($oIE) For $oForm In $oForms MsgBox($MB_SYSTEMMODAL, "Form Info", $oForm.name) _IEImgClick($oForm.name, "Reserved.ReportViewerWebControl.axd?OpType=Resource&amp;Version=12.0.5522.0&amp;Name=Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources.TogglePlus.gif", "src") Next I am having trouble clicking an image. Here is what I have tried. 

    • Jefrey
      By Jefrey
      I've made this HTTP lib to simplify HTTP requests, mainly when dealing about POST data or file uploads.
      Three functions are available:
      string _HTTP_Get ( string $sURL ) string _HTTP_Post ( string $sURL , string $sPostData ) string _HTTP_Upload ( string $sURL , string $sFilePath , string $sFileField , string $sPostData = '' , string $sFilename = Default) Additionaly, two helper functions are also available:
      URLEncode($sStr) URLDecode($sStr) Full documentation: https://github.com/jesobreira/HTTP.au3/blob/master/README.md
      Fork me on Github: https://github.com/jesobreira/HTTP.au3
      Download lib + docs: https://github.com/jesobreira/HTTP.au3/archive/master.zip
    • mjolnirmarkiv
      By mjolnirmarkiv
      Hi!
      Does anyone have any idea why Test() returns 0, while Test2() returns 1?
      #include <IE.au3> MsgBox(0, "", Test() & " " & Test2()) Func Test() Local $oHTML = ObjCreate("HTMLFILE") $oHTML.body.innerHTML = FileRead("Test.html") Return IsObj($oHTML.getElementsByClassName("example")) EndFunc Func Test2() Local $oIE = _IEAttach("", "instance", 1) Return IsObj($oIE.document.getElementsByClassName("example")) EndFunc Sample Test.html I open in IE before testing:
      <!DOCTYPE html> <html> <body> <p class="example"></p> <div class="example"></div> </body> </html> I'm receiving html text in a response to http request, I need to parse it fast and easy, getElementsByClassName would have been ideal. I'm using 3.3.12.0 version.