Perl script to join tiles to map file

Discussion in 'Perl' started by wever, Oct 24, 2022.

  1. wever

    wever New Member

    Joined:
    Sep 4, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Hello. I have used this tool to create map. I have saved the map as html file and the folder contains images which I want to join to one file to create a map.

    Bitmap

    There is also this original script which can be used to download the images:


    When I have run it with perl, I got error 403 forbidden.

    So I would like to modify it because I have the files on my disk allready.

    The filenames look like this...

    1140 files total.

    My try was like:



    Can you please help to modify the script to complete the file from files on my disk?

    PS: I tried to upload the .pl files or to insert code but no success.
     
  2. wever

    wever New Member

    Joined:
    Sep 4, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    I have no idea why I cannot sent the code or links to it.
    The files I wanted to join.
    1378_001.png ... 1378_095.png

    1379_001.png ... 1379_095.png

    1380_001.png ... 1380_002.png .... 1380_078.png
     
  3. wever

    wever New Member

    Joined:
    Sep 4, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    one more try to send the files.
     

    Attached Files:

  4. wever

    wever New Member

    Joined:
    Sep 4, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Update code... I am stuck on the part where GD::Image->new() accepts argument $resp->content because there is not browser run and any download for the files been on disk.

    Also I dont fully understand the use of "next" and why foreach was used in original code. I would expect to use some way of reading directory files of type *.png.


    On the other hand on stackoverflow I have found a code to read directory.
    opendir(DIR, ".") or die "cannot open directory";
    Code:
    # I GUESS I SHOULD REPLACE THE PREVIOUS foreach WITH THIS ONE:
    @docs = grep(/\.pl$/,readdir(DIR));
    foreach $file (@docs) {
       open (RES, $file) or die "could not open $file\n";
       while(<RES>){
           print "$_";
       }
    }
    
    But can someone help me to make it work to use the image with GD::Image->new()? What argument should I pass to new()?
     
  5. wever

    wever New Member

    Joined:
    Sep 4, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    The update code till now.
     

    Attached Files:

  6. wever

    wever New Member

    Joined:
    Sep 4, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    I am almost finished.
    See the urls. I would maybe suggest to create less size map to prevent their server to be overloaded if you wish to test it now.

    I send a php script to you which I used to rename the files listed in bigmap.html.

    One problem: In the resulting image, there is one column free. Probably some mistake in a logic...
     

    Attached Files:

  7. wever

    wever New Member

    Joined:
    Sep 4, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Yet this was the bigmap.htm which I have modified to get the list of files. The problem of naming of the images is that the named of columns are mixed. Hence the php script renames the downloaded files.
     

    Attached Files:

  8. nickmistman

    nickmistman New Member

    Joined:
    Oct 20, 2021
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Seems really interesting. Thanks for this information!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice