home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.linux      Getting to be as bloated as Windows!      107,822 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 107,607 of 107,822   
   Brock McNuggets to bad sector   
   Re: bash help   
   08 Nov 25 17:40:06   
   
   From: brock.mcnuggets@gmail.com   
      
   On Nov 8, 2025 at 9:09:51 AM MST, "bad sector" wrote   
   <8R-cnUwRkr7E9pL0nZ2dnZfqn_qdnZ2d@giganews.com>:   
      
   >   
   > Here's a snipet from my _flintstones_ bash script   
   > aiming to generate an image of the number that is   
   > the variable 'size'.   
   >   
   >   
   > output_file="number_image.png"   
   > # 'imagemagic convert' the number to an image   
   > # the old 'convert' is now 'magic'   
   > magick -pointsize 90 \   
   >    -fill "#cccccc" -background "#002200" label:"$size" "$output_file"   
   >   
   > I use 'feh' to splash random (quiz) numbers right onto the kde desktop   
   > but the current code does not format and I end up with unplesant   
   > transparency holes.   
   >   
   > I'd like to upgrade the script so as to generate image 'output_file' as   
   > the white image of a 4 digit number with up to 3 leading zeros on a   
   > black background, or up to 3 leading black spaces insted of zeros.   
   >   
   > TIA   
      
   #!/bin/bash   
      
   size="$1"   
   output_file="number_image.png"   
      
   # Pad with zeros (or spaces)   
   formatted=$(printf "%04d" "$size")   
      
   # Generate the image   
   convert -size 300x120 \   
     -background black \   
     -fill white \   
     -font DejaVu-Sans-Bold \   
     -gravity center \   
     -pointsize 90 \   
     label:"$formatted" \   
     "$output_file"   
      
   -----   
      
   Saves it to your home folder. Of course you can change the path as you wish.   
   Tested on Ubuntu and it worked.   
      
   I did use ChatGPT to help me make this... if that matters.   
      
   --   
   It's impossible for someone who is at war with themselves to be at peace with   
   you.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca