Jump to content
Sign in to follow this  
x_bennY

Merge multiple images into a single file

Recommended Posts

Hey! i'm writing a script that uses a lot of images(more than 1000), this images(each one) are storaged outside the .exe, i was wondering if it's possible to merge all these images into a single file(not side by side) and read them separately.

For example...

IMAGE1.png (100kb)

IMAGE2.png (200kb)

IMAGE3.png (250kb)

After merge... -> IMAGES.dat(550kb)

Inside my script i need to read from this IMAGES.dat all the IMAGES merged(IMAGE1, IMAGE2 and IMAGE3).

The idea is not use resources UDF because i don't want a big .exe, and be able to have a bunch of different images databases.

 

Thx!

Share this post


Link to post
Share on other sites

Very possible, i would do it like this:

read each image in binary and write the content to the new file + a unique string or something thats going to serve as delimiter.

repeat for all images, when its time to extract split by the unique string.

Just dont know the size limits for something like this but i've done something similar, biggest file was like 300mbs.


Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

@careca i thought it too, but the problem is that every time that i request a image it will read or split every image in the file and i don't think it would be nice, because my application needs to run relatively fast. It's 3000 images(923Mb)

I was thinking on use BLOBs from SQLite, but i never used it :( (The topic that i found here it's closed and outdated)

Do you have any other solution in mind?

Edited by x_bennY

Share this post


Link to post
Share on other sites

Maybe, grabbing the same idea as before, but creating a separate ini or something that would have a list, and the start and end byte positions, this way you could just read the ini, and then extract the bytes from x to y byte position, and nothing else, i think of it as an index.


Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

@x_bennY instead of a DB try to use 

Just an idea and not tested.


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

@UEZ WOW! This is exactly what i need! Why a such good and awesome UDF wasn't well viewed??

I'm justing having some problemns trying to use the function "_PK_ExtractPacketData" to read the data(image) from the packeged file and put i't on a GUI. I'm getting this error: $PK_ERROR_INVALID_PARAMETER (7)... don't know why.

This function stores the data into a buffer, i think i'm calling it wrongly

 

; #FUNCTION# ====================================================================================================================
; Name...........: _PK_ReadPacketData
; Description....: Reads a data from the "Data" section of the packet to the specified memory buffer.
; Syntax.........: _PK_ReadPacketData( $hPackage, $iPacket, $pBuffer, $iBytesToRead )
; Parameters.....: $hPackage      - A handle to the package. To obtain the handle, call the _PK_Create() or _PK_Open() function.
;                  $iPacket       - A unique 64-bit packet identifier (ID) whose data should be read. Alternatively, you can specify the
;                                   1-based sequence number of the packet within a package. In this case, it should be a negative
;                                   number, for example (-1), (-2), etc.
;                  $pBuffer       - A pointer to a memory block (buffer) that receives the read data. You must allocate the
;                                   buffer before call the function. The length of the buffer must not be less than the number
;                                   of bytes that is to be read.
;                  $iBytesToRead  - The maximum number of bytes to be read from the "Data" section of the packet.
; Return values..: Success        - The number of bytes that has been actually read.
;                  Failure        - 0 and sets the @Error flag to one of the following values:
;
;                                   $PK_ERROR_NOT_FOUND (1)
;                                   $PK_ERROR_INVALID_HANDLE (2)
;                                   $PK_ERROR_INCOMPATIBLE_VERSION (4)
;                                   $PK_ERROR_INSUFFICIENT_BUFFER (5)
;                                   $PK_ERROR_INVALID_PARAMETER (7)
;                                   $PK_ERROR_UNEXPECTED (9)
;
; Author.........: Yashied
; Modified.......:
; Remarks........: Unlike the _PK_ExtractPacketData() function that reads data entirely, the _PK_ReadPacketData() allows to read
;                  a part of the packet data. Moreover, this function does not perform decompression of the compressed data. In most
;                  cases this function is not necessary because the library does not provide decompression of the packet data
;                  independently, but may be useful for advanced users.
;
;                  To obtain the exact size of the "Data" section, call the _PK_GetPacketDataLength() function.
;
; Related........: _PK_AddPacket, _PK_AddPacketFromFile, _PK_ExtractPacketData, _PK_ExtractPacketDataToFile, _PK_Purge, _PK_RemovePacket
; Link...........:
; Example........:
; ===============================================================================================================================

Func _PK_ReadPacketData($hPackage, $iPacket, $pBuffer, $iBytesToRead)

    Local $tPacket, $Data

    If Not $pBuffer Then
        Return SetError(7, 0, 0)
    EndIf
    $tPacket = __pk_EnumPackets($hPackage, Number($iPacket))
    If @Error Then
        Return SetError(@Error, 0, 0)
    EndIf
    $Data = __pk_QueryPacket($hPackage, $tPacket)
    If @Error Then
        Return SetError(@Error, 0, 0)
    EndIf
    If Not _WinAPI_SetFilePointerEx($hPackage, $Data[0] + $Data[1], $FILE_CURRENT) Then
        Return SetError(9, 0, 0)
    EndIf
    If $iBytesToRead > $Data[2] Then
        $iBytesToRead = $Data[2]
    EndIf
    If Not __pk_ReadFile($hPackage, $pBuffer, $iBytesToRead) Then
        Return SetError(9, 0, 0)
    EndIf
    Return $iBytesToRead
EndFunc   ;==>_PK_ReadPacketData

*****Just fond solution on the topic of the UDF.

 

 

 

 

Edited by x_bennY

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...