Setup Pannellum generate panorama script in Docker in MacOS

docker-generate-multires.png

Selasa, 31 Oktober 2023, 9:35 am0

Pannellum (https://pannellum.org/) is the JS library I use to host panoramic images in this blog, tagged under . Before this I generate the multi resolution images on my Thinkpad ⁽¹⁾ or Mac Mini, and it’s been over 2 years since I setup those. I need to setup the generate script in my Macbook Air ⁽²⁾ since it’s my main for blogging.

  1. Install Docker for Mac (https://docs.docker.com/desktop/install/mac-install/). Download the .dmg file, after done, mount it & drag the app into Application folder.
  2. Check docker command in Terminal, which docker, it should exist in /usr/local/bin/docker
  3. By referring documentation at https://github.com/mpetroff/pannellum/tree/master/utils/multires
    • get Dockerfile & generate.py, and put them in one folder.
  4. Build docker container
    • using Terminal, go to the folder containing Dockerfile & generate.py files.
    • run docker build -t generate-panorama .
  5. Add generate_panorama as alias in ~/.zshrc
    alias generate_panorama='f() { docker run -it -v $PWD:/data generate-panorama --output /data/output /data/$1; cd output; zip -r ../$1.zip *; cd ..; rm -fr output };f'
  6. To use this command:
    • cd folder
    • generate_panorama 01.jpg, this will generate 01.jpg.zip file

⁽¹⁾ https://azwan082.my/2021/03/bukan-hadiah-krismas-tapi-jadi-hadiah-birthday-pulak-thinkpad-x260-/
⁽²⁾ https://azwan082.my/2023/04/pinky-sungguh-macos-monterey/

ShareTweetSaveSendCopy