Jump to content
Sign in to follow this  
wakillon

Html-Imager Update of 17 Dec 2014

Recommended Posts

wakillon

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
  • Like 3

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
SmOke_N

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

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.

Share this post


Link to post
Share on other sites
wakillon

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
SmOke_N

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


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.

Share this post


Link to post
Share on other sites
wakillon

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
UEZ

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
wakillon

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

 

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
mLipok

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 UDF * 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 * Good coding practices in AutoIt * 

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: 2018-03-17

Share this post


Link to post
Share on other sites
TheSaint

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
wakillon

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
UEZ

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
wakillon

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
UEZ

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
wakillon

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
UEZ

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
wakillon

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
UEZ

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  

  • Similar Content

    • Xandy
      By Xandy
      MapIt is a tile world editor.  MapIt was built around the concept of reversing Dragon Warrior map images.  MapIt can take image input and produce a tile and world array.
      MapIt features Unity style dragable labels that adjust property values.

      MapParser is a C++ project that scans images for unique tiles.  MapParser is very fast.  Due to hard drive failure, many bugs were restored b/c I had to rewind many years.  Frustrated with the design, I wrote a new version from the ground up.  This New Version:  AutoIt Front-end, command line controls, and shared with the world; so that I can't lose it again.
      You can toggle the C++ MapParser off to see the difference in speeds between the MapParser CPP verse AutoIt function.  Function is named Scan_Tiles() in AutoIt.  You can also chose to download without MapParser.exe.
      At the moment Scanning a image resets the arrays, but you can add tiles after scanning.
      Images can be added as tiles without scan image at all.  Then configure settings to give your world parameters and manually fill the world data with tile indexes.
      Using the settings you can change tile size after a scan.  Example: you wanted to replace a map with different sized tiles.
      Changing and replacing tile / world data is easy.  B/c tile world editor.

      Hotkeys, I use CTRL+R in image above to signal replace tile action and I use "G" to Get the tile under mouse.
      Hotkeys are not saved to disk and thus are set to default between sessions.
      I might draw the world to pre-rendered surfaces and use them as multi-layer someday.  I do that in my AutoIt, DragonWarrior Remake but I could spend forever unsure what features are important for this.  The DW_Remake has a method of replacing a tile with a tile on two layers.  So you could replace a tree on the first layer with a grass, and a tree in the second layer.  This is all getting very confusing.
      I attempted to write the good code.  If something could be better, please advise.
      Fifth release.  Enjoy.
      For download, videos, and example of created world file data; please visit the MapIt webpage: http://songersoft.com/programming/mapit/mapit_about.phtml
      Special thanks: @AdmiralAlkex, @Melba23, @MrCreatoR
      Main AutoIt source file: Will not run without other Includes and SDL DLLs.
      Last Update: 5/26/2018 3:45 PM EST
      REMOVED CODE BLOCK:  I was informed the this page loaded very slowly, one solution so far has been to remove the 2k lines in the code block.
      When I recieve more feedback from the User I may reduce image size or remove images.
      Next Version Added: $eSETTING_TILE_LAST_PATH I have the weekend, I want to write world layers with aBoard surfaces.  
    • SkysLastChance
      By SkysLastChance
       
      WinActivate("MEDITECH - Internet Explorer") Sleep (500) $oIE = _IEAttach("MEDITECH") $oDiv1 = _IEGetObjById($oIE, "sysmenu-searchbarbutton") _IEAction($oDiv1, "click") I am just trying to click the little magnifying glass, next to the gear button with no luck. I was hoping someone might have an idea why this is not working?
       

    • Burgs
      By Burgs
      Hello,
        I have a website with a Google Map I setup using the Google Map API.  It works and displays just fine.  However to make it useful to me I need to be able to dynamically change the map to display different areas by sending new Latitude and Longitude coordinates.  I am having difficulty making this happen.  Here is my code thus far:
      #include <IE.au3> $oIE3 = _IECreate("http://my_sample_website.html") ;just an example, not an actual site... _IELoadWait($oIE3) $s_word = "lat:" $oInputs = _IETagNameAllGetCollection($oIE3) if @error <> 0 Then MsgBox($MB_SYSTEMMODAL, "ERROR", "Error is: " & @error) EndIf ;@error For $oInput In $oInputs if Number($iPos) == -1 Then $iPos = StringInStr($oInput.innerHTML, String($s_word)) if (Number($iPos) > 0) AND (@error == 0) Then ConsoleWrite("I FOUND IT...! " & String($s_word) & @CRLF) $sHTML = _IEBodyReadHTML($oIE3) $_lat_look = 0 $_lng_look = 0 $_end_look = 0 ;default $_lat_look = StringInStr(String($sHTML), "lat:") if Number($_lat_look) <> 0 Then $_lng_look = StringInStr(String($sHTML), "lng:") if Number($_lng_look) <> 0 Then $_end_look = StringInStr(String($sHTML), "}") if Number($_end_look) <> 0 Then ConsoleWrite("HTML BODY: " & $sHTML & @CRLF) $_old_lat = String(StringMid(String($sHTML), $_lat_look, ($_lng_look - $_lat_look))) $_old_lng = String(StringMid(String($sHTML), $_lng_look, ($_end_look - $_lng_look))) ConsoleWrite("$_old_lat: " & $_old_lat & @CRLF) ConsoleWrite("$_old_lng: " & $_old_lng & @CRLF) $_new_lat = "lat: " & String("-34.397") & ", " $_new_lng = "lng: " & String("150.644") & "}; " ConsoleWrite("...new lat is: " & String($_new_lat) & " new lng is: " & String($_new_lng) & @CRLF) $_LOOK = StringReplace($_old_lat, 1, String($_new_lat)) $_LOOK2 = StringReplace($_old_lng, 1, String($_new_lng)) ConsoleWrite("$_LOOK: " & $_LOOK & "$_LOOK2: " & $_LOOK2 & @CRLF) EndIf ;'$_end_look' NOT "0"... $iPos = -1 EndIf ;'String($s_word)' was found in the collection '$oInputs' EndIf ;'$iPos' is "-1" Next  
        I am having trouble trying to replace the line in the HTML ($sHTML variable in my example) that contains the "lat:" and "lng:" information.  I figure if I can replace that line everything else remains the same, and in theory, the map should cycle to display a map with the new latitude and longitude coordinates...I hope. 
        I have attempted to write the $sHTML to a text document and then use '_IEBodyWriteHTML' to read it back into the webpage HTML however that is not working.  There must be an easier method to accomplish this...what am I missing here...?  Any thoughts greatly appreciated.  Regards.       
    • lenclstr746
      By lenclstr746
      HELLO GUYS
      I'm a work on a background see and click bot project 
      I can complete it if your help me
      (using imagesearch , gdi+ and  fastfind)
    • dadalt95
      By dadalt95
      I would like to know if it's possible to pass an image recognition (captcha) system.
       
      What are the ways to achieve this?
      Just the references or links is enough for me by now.
       
      Thanks by now!
       
      Thanks!
×