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 Forum Rules *
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 APIErrorLog.au3 UDF - A logging Library
 

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 * Dual Monitor resolution detection *

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) * IE in TaskScheduler

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-10-15

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
      Special thanks: AdmiralAlkex, Melba23, MrCrearoR, Dragon Warrior 3, SDL
      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.  
      Changing and replacing tile / world data is easy.  B/c tile world editor.

      CTRL+R in image above to signal replace tile action and I use "G" to Get the tile under mouse.
      A full list of hotkeys can be assigned in the: Help Menu\Hotkeys
       
      MapParser is a C++ project that scans images for unique tiles. 
      MapIt can be downloaded without MapParser. MapParser can be toggled off in the Scan_Image dialog. Without MapParser, MapIt will use the Scan_Tiles() function written in AutoIt ; which is 100 * slower Idk. If MapParser.exe will not run for you:      Installing Visual C++ Redistributable for Visual Studio 2015 should fix it: https://www.microsoft.com/en-us/download/details.aspx?id=48145   
      You can start with example world and tiles.
      Example world was made following these steps:
      Started with a tile map image of DragonWarrior3 town of: Reeve From MapIt World Menu \ New \ Scan_Image dialog, I set the area to exclude the key legend to the far right of image. After scanning the map image to world and tile array.  I removed a few of the map artifacts.  More work could be done on this world; removing unwanted tiles, but it is fine for now. I saved my world to disk.  This creates folder: Worldname: Containing folder of Tiles and a Worldname.txt. Using The Gimp, I edited some tiles to have a transparent color: Stairs, Trees, Desk Tables, Chest-of-drawers, Chairs, Signs, Doors, Beds. I changed the world layers to 2: World Menu \ Properties. F9 Finds all selected tile on current layer and changes to a new selected tile on new layer. I used F9 to change all Trees on layer: 0 to Trees on layer: 1. Then I used F9 to change all Trees on layer: 0 to Grass on layer: 0  
      In this video you can see how I used the Tile Menu \ Replace From Disk option to remap tile images to my custom tiles.  Conveniently my tiles already have a transparent pixel.
      See video for how that was done:
      To use the example world:
      First unzip the world save file: http://songersoft.com/programming/mapit/worlds/Reeve_Swapped.zip From the World Menu: choose \Load Navigate to the Reeve_Swapped.txt located in the extracted zip. Or you can scan any image.
      The map images I used are here: http://www.realmofdarkness.net/dq/games/nes/dw3/maps/world
      For download, videos, and example of created world file data; please visit the MapIt webpage: http://songersoft.com/programming/mapit/mapit_about.phtml
    • ur
      By ur
      Is there any UDF to remove all anchor tags <a> with a particular class (and also its sub elements completely) in a html document.
      Here the classes are browse and breadcrumbs
      Like in the below image.


       
      I am not able to find that option in IE.au3
       
      Please suggest.
    • milkmoron
      By milkmoron
      I am trying to automate something in a web browser but i need some help with finding the html code to a web applet. How do I access the code.
    • Atoxis
      By Atoxis
      Howdy, I've gone through a lot of au3 forums, and I once had a working Imagesearch script that I got from here.  However, and i'm just totally not sure how but my imagesearch scripts aren't working anymore.
      I'm not new to au3 but i'm not the most experienced with it's syntax/commands.

      Anyways, I've looked over the big threads involving imagesearch.

      Does anyone have a working Imagesearch x64 for win10 that is currently working as of the date with the post.

      Dll's and what not is fine, just when I tell the script to run, I want to be able to find the image on the screen!
      Can't find a working copy so if anyone has one please send it my way lol.

      I've taken all the imagesearch downloads and what not and have played with them but I can't get any of them working on my end, despite others saying they're working.
      Thanks.
    • Seminko
      By Seminko
      Is there a way to grab non-hardcoded but rather javascript generated data from a webpage?
      Tried a get request as well as _IEBodyReadHTML but both seem to grab the code without the javascript generated data.
      $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "link", False) $oHTTP.Send() $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status Global $DataArray[10][5] If $oStatusCode <> 200 Then Exit MsgBox(1, "Error", "Status Code <> 200") EndIf FileWrite(@ScriptDir & "\output.txt", $oReceived) ; //////// #include <IE.au3> Local $FullLink = "link" Local $oIE = _IECreate($FullLink, 0, 0) _IELoadWait($oIE) Local $sText = _IEBodyReadHTML($oIE) FileWrite(@ScriptDir & "\output.txt", $sText)  
×