build Thumbs for Preview with HMG

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

build Thumbs for Preview with HMG

Post by AUGE_OHR »

hi,

this Code create Thumbs for Preview and need about 1/10 Sec for a Image so when have 100 Image it take 10 Sec.
Thumbs_Load.jpg
Thumbs_Load.jpg (17.9 KiB) Viewed 1950 times
searching for a faster Way when have 1000 or more Image :idea:
THUMBS01.ZIP
(3.57 KiB) Downloaded 118 times
have fun
Jimmy
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: build Thumbs for Preview with HMG

Post by mustafa »

Hi jimmy
Very good !!!
Can the Thumbs be saved ?

Regards
Mustafa
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: build Thumbs for Preview with HMG

Post by mol »

I've tried to test it for folder with c.a. 600 pictures, but app hangs up.
With folder with 99 hangs up too - the progressbar stays in 5% and aftrs about 74 seconds - it shows thumbs. These pictures are about 4,5MB each

You should add DO EVENTS in for-next loop to refresh progressbar.
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: build Thumbs for Preview with HMG

Post by AUGE_OHR »

mol wrote: Tue Apr 07, 2020 6:14 pm I've tried to test it for folder with c.a. 600 pictures, but app hangs up.
With folder with 99 hangs up too - the progressbar stays in 5% and aftrs about 74 seconds - it shows thumbs. These pictures are about 4,5MB each
Code include #IFDEF
default is using BT_Function.
please try again and disable if it make a Difference

Code: Select all

// #define Use_BT     .T.
mol wrote: Tue Apr 07, 2020 6:14 pm You should add DO EVENTS in for-next loop to refresh progressbar.
OK, thx for Tip
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: build Thumbs for Preview with HMG

Post by AUGE_OHR »

hi,
mustafa wrote: Tue Apr 07, 2020 6:05 pm Can the Thumbs be saved ?
hm ... i "just" want a Preview so i have not think about ... :idea:

this Line make Thumb

Code: Select all

   hBitmap1 := BT_BitmapCopyAndResize( hBitmap1_aux, 128, 128, NIL, BT_RESIZE_HALFTONE )
from c:\hmg.3.4.4\SOURCE\BosTaurus\h_BosTaurus.prg

Code: Select all

Function BT_BitmapSaveFile (hBitmap, cFileName, nTypePicture)
   LOCAL lRet
   nTypePicture := IF (Valtype(nTypePicture) == "U", BT_FILEFORMAT_BMP, nTypePicture)
   lRet := BT_BMP_SAVEFILE (hBitmap, cFileName, nTypePicture)
Return lRet
so it is "build-in" HMG
BT_BitmapSaveFile (hBitmap, cFileName, nTypePicture)

Save an image (BMP, JPG, GIF, TIF or PNG) in the disk.

hBitmap: is a handle to the bitmap image.

cFileName: is the name of the file to save.

nTypePicture: specifies the format in which you want to save the image, it is one of the constants: BT_FILEFORMAT_BMP, BT_FILEFORMAT_JPG, BT_FILEFORMAT_GIF, BT_FILEFORMAT_TIF or BT_FILEFORMAT_PNG (defined in BosTaurus.CH). For default nTypePicture = BT_FILEFORMAT_BMP.
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: build Thumbs for Preview with HMG

Post by andyglezl »

En mis inicios con HMG, yo utilice una utileria para hacer esto:
(todavía no existía la BosTaurus del Dr. Claudio Soto)
*----------------------------------------------------------------------------------
In my early days with HMG, I used a utility to do this:
(Dr. Claudio Soto's BosTaurus did not yet exist)

Code: Select all

FUNCTION ScanDesdeArch()
    LOCAL cDirAct:=GetCurrentFolder()
    LOCAL cpso3:="", cpso2:="", cpso := Getfile({{'Imagenes','*.jpg'}},'Abrir','C:\', .f. , .t. )

    cpso2:=CScann+'D'+AllTrim(cCodigo)+"-"+ALLTRIM(STR(DOY(DATE())))+"-"+STRTRAN(TIME(),":",".")+'.jpg'
    cpso3:='D'+AllTrim(cCodigo)+"-"+ALLTRIM(STR(DOY(DATE())))+"-"+STRTRAN(TIME(),":",".")+'.jpg'
    SetCurrentFolder( cDirAct )
    IF LEN( cpso ) > 1
        __CopyFile( cpso, cpso2)
        //---- ThumConv.exe Crea el Thumbnail  -----------------------------------------------------
        cTemp:="-resize 100x100 "+cpso2+" -thumbnail 100x100! "+CScann+"Thumbs\"+cpso3
        ShellExecute(0, "open", "ThumConv.exe", cTemp, , 0)
    ENDIF
RETURN( Nil )
Thumb.png
Thumb.png (277 KiB) Viewed 1920 times


Ahora se llama:
*------------------
Now it's called:


https://imagemagick.org/index.php
https://imagemagick.org/script/command- ... essing.php
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: build Thumbs for Preview with HMG

Post by mol »

I measured time in for next loop.
Whole time to create picture control 74.360 sec.
Time for resizing images 5.733 sec.
I this here is a problem of duration - creating picture controls is very inefficent in HMG
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: build Thumbs for Preview with HMG

Post by AUGE_OHR »

navigation in virtual Height

hi,

for my Thumbs i use

Code: Select all

  VIRTUAL HEIGHT nHeight + 1 ;
i can use Scrollbar for "up/down" but not Cursor or PgUp/PgDn ... :(

what can i do to use Keyboard to scroll up/down :idea:
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: build Thumbs for Preview with HMG

Post by andyglezl »

Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: build Thumbs for Preview with HMG

Post by AUGE_OHR »

andyglezl wrote: Fri Apr 24, 2020 2:33 am Maybe this ...
THX, i will study it
have fun
Jimmy
Post Reply