Server IP : 85.214.239.14 / Your IP : 3.128.199.6 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/task/2/root/bin/ |
Upload File : |
#!/bin/sh # # ppmmargin - add a margin to a PNM image # # Copyright (C) 1991 by Jef Poskanzer. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, provided # that the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation. This software is provided "as is" without express or # implied warranty. tempdir=$(mktemp -d "${TMPDIR:-/tmp}/netpbm.XXXXXXXX") || { echo "Could not create temporary file. Exiting." 1>&2; exit 1; } trap 'rm -rf $tempdir' 0 1 3 15 tmp1=$tempdir/pnmm1 tmp2=$tempdir/pnmm2 tmp3=$tempdir/pnmm3 tmp4=$tempdir/pnmm4 color="-gofigure" plainopt="" # Parse args. while true ; do case "$1" in -version|--version ) pnmpad --version; exit $?; ;; -p|-pl|-pla|-plai|-plain ) plainopt="-plain" shift ;; -w|-wh|-whi|-whit|-white ) color="-white" shift ;; -b|-bl|-bla|-blac|-black ) color="-black" shift ;; -c|-co|-col|-colo|-color ) shift if [ ! ${1-""} ] ; then echo "usage: $0 [-white|-black|-color <colorspec>] <size> [pnmfile]" 1>&2 exit 1 fi color="$1" shift ;; -* ) echo "usage: $0 [-white|-black|-color <colorspec>] <size> [pnmfile]" 1>&2 exit 1 ;; * ) break ;; esac done if [ ! ${1-""} ] ; then echo "usage: $0 [-white|-black|-color <colorspec>] <size> [pnmfile]" 1>&2 exit 1 fi size="$1" shift case $size in ''|*[!0-9]*) echo "Size argument '$size' is not a whole number" exit 1 ;; esac if [ ${2-""} ] ; then echo "usage: $0 [-white|-black|-color <colorspec>] <size> [pnmfile]" 1>&2 exit 1 fi # Capture input file in a tmp file, in case it's a pipe. # TODO: This code does not consider the case when the input file is specified # and there is also input coming in from a pipe. cat $@ > $tmp1 if [ $size -eq 0 ] ; then # Zero margin; just copy input to output pamtopnm $plainopt $tmp1; else # If -white or -black, write output with pnmpad and exit. # Otherwise construct spacer files. case "$color" in -gofigure ) pamcut 0 0 1 1 $tmp1 | pnmtile $size 1 > $tmp2 ;; -white | -black ) pnmpad $plainopt $color \ -left=$size -right=$size -top=$size -bottom=$size $tmp1 exit ;; * ) ppmmake $color $size 1 > $tmp2 ;; esac pamflip -rotate90 $tmp2 > $tmp3 # Cat things together. pamcat -leftright $tmp2 $tmp1 $tmp2 > $tmp4 pamcat -topbottom $plainopt $tmp3 $tmp4 $tmp3 fi