Splitting big planet bitmap into titles

Tips for creating and manipulating planet textures for Celestia.
Topic author
FSword7
Posts: 15
Joined: 08.09.2017
With us: 3 years 1 month

Splitting big planet bitmap into titles

Post #1by FSword7 » 16.10.2020, 03:13

Does anyone know any tools or codes for splitting huge planet bitmap like blue marble bitmaps into individual tiles at LOD levels?

Tim

john71
Posts: 491
Joined: 10.08.2016
With us: 4 years 2 months

Post #2by john71 » 16.10.2020, 13:47

GIMP should do the trick. Try the Filters function.

Avatar
John Van Vliet
Posts: 2749
Joined: 28.08.2002
With us: 18 years 1 month

Post #3by John Van Vliet » 16.10.2020, 19:51

i do

it is a script that uses the VPIS image lib
https://github.com/libvips/libvips/releases

you might also want to use the GUI to the lib - called Nip2
https://github.com/libvips/nip2

Code: Select all

#! /bin/bash
function min () {
         if(( $1 < $2 )); then
                  echo $1
         else
                  echo $2
         fi
}

if [ $# -lt 3 -o "$1" = " --help" ] ; then
 echo
 echo ' Usage: vipsvt [--help | <texture name><tile size><tile format>] [e|E|w|W]'
 echo
else
block_width=$2;
block_height=$2;

dir=`dirname $1`
file=`basename $1`
fileformat=$3
#copy=$$_$file.v
 #echo making local copy of image as $copy ...
 
#vips im_copy $1 $copy

width=`vips im_header_int Xsize $file`
height=`vips im_header_int Ysize $file`

j=0

while (( j * block_width + block_width <= height ));do
      ((top = j * block_width ))
  if [ $# -eq 4 ]; then
     if [ "$4" = "e" -o "$4" = "E" ]; then
          ioff=$(( width/block_width ))
     elif ["$4" = "w" -o "$4" = "W" ]; then
          ioff=0
      else
       echo
       echo "*** Incorrect 4th paramenter! **"
       echo
      return
    fi
 fi
 
i=0

    while (( i * block_width + block_width <= width )); do
          ((left = i * block_width))
          toname=$dir/tx_$((i + ioff))_${j}.$fileformat
         
          ((right = $width - $left))
          ((bottom = $height - $top))
         
          tile_width=`min $block_width $right`
          tile_height=`min $block_height $bottom`
         
     echo extracting tile $left $top as $toname
          vips im_extract_area $file $toname \
              $left $top $tile_width $tile_height

   
   ((i++))
   done
   ((j++))
  done
 
  # rm $$_$file.v
  # rm $copy
   #rm $$_$file.desc
fi


on a oldish computer it takes about 5 min. to cut up a 64k map
on my NEW I9 cpu , 32 gig ram box it takes about 1.5 min


as to fridger's tools they are still offline with the celestialmatters web site

john71
Posts: 491
Joined: 10.08.2016
With us: 4 years 2 months

Post #4by john71 » 16.10.2020, 21:40



Return to “Textures”

Who is online