Package Details: shitpost 4-1

Git Clone URL: (read-only, click to copy)
Package Base: shitpost
Description: A tool to create memes using CLI
Upstream URL:
Licenses: custom:DWTFYW
Submitter: Baudouin
Maintainer: magnus-tesshu
Last Packager: magnus-tesshu
Votes: 9
Popularity: 0.26
First Submitted: 2016-11-27 20:07
Last Updated: 2021-09-28 21:14

Latest Comments

magnus-tesshu commented on 2021-09-28 21:16

@coolreader18 all the features in the patch are now in the base package, thanks!

coolreader18 commented on 2021-03-01 20:45

I've patched this a little bit with some qol improvements, figured someone might find it useful.

diff --git a/shitpost b/shitpost
index 8710946..2313d66 100755
--- a/shitpost
+++ b/shitpost
@@ -34,12 +34,13 @@ OPTIND=1
 top_text=" "
 bottom_text=" "

-while getopts "h?t:b:f:" opt; do
+while getopts "h?t:b:f:o:" opt; do

     case "$opt" in
-        printf "Available options are:\n t - Top Text\n b - Bottom Text\n f - Path to image file - Mandatory!\n"
+        printf "Available options are:\n t - Top Text\n b - Bottom Text\n f - Path to image file - Mandatory!\n o - Output file\n"
         exit 0
     t)  top_text="$OPTARG"
@@ -48,6 +49,8 @@ while getopts "h?t:b:f:" opt; do
     f)  image_file="$OPTARG"
+    o)  output_file="$OPTARG"
+        ;;

@@ -71,30 +74,37 @@ base=${image_file##*/}

+if [ -z "$output_file" ]
+    then output_file="$PWD/shitpost-$pref.$fext"
+#Create a work directory + register cleanup for it
+tmpdir=$(mktemp -d)
+trap 'rm -rf "$tmpdir"' EXIT SIGINT
 #Upscale the image if it's too shitty. This is required to make the text readable as it's generated to fit the pixels of the original
-convert -resize 1024x1024\< "$image_file" shitpost-temp-resize.png
+convert -resize 1024x1024\< "$image_file" "$tmpdir"/shitpost-temp-resize.png

 #Get the height and width of the image to use later to size the overlays. Clipped height keeps things locked in the top and bottom fifth of the image.
-image_width=`identify -format "%[width]" shitpost-temp-resize.png`
-image_height=`identify -format "%[height]" shitpost-temp-resize.png`
+image_width=$(identify -format "%[width]" "$tmpdir"/shitpost-temp-resize.png)
+image_height=$(identify -format "%[height]" "$tmpdir"/shitpost-temp-resize.png)

+printf "Working"

-convert -background none -fill white -stroke black -strokewidth "$stroke_width" -size "$image_width"x"$clipped_height" -gravity Center -font 'Impact' caption:"$top_text" temp-top-text.png
-convert -background none -fill white -stroke black -strokewidth "$stroke_width" -size "$image_width"x"$clipped_height" -gravity Center -font 'Impact' caption:"$bottom_text" temp-bottom-text.png
-composite -gravity north temp-top-text.png shitpost-temp-resize.png shitpost-temp-composite.png
-composite -gravity south temp-bottom-text.png shitpost-temp-composite.png shitpost-"$pref"."$fext"
+convert -background none -fill white -stroke black -strokewidth "$stroke_width" -size "$image_width"x"$clipped_height" -gravity Center -font 'Impact' caption:"$top_text" "$tmpdir"/temp-top-text.png
+printf "."
+convert -background none -fill white -stroke black -strokewidth "$stroke_width" -size "$image_width"x"$clipped_height" -gravity Center -font 'Impact' caption:"$bottom_text" "$tmpdir"/temp-bottom-text.png
+printf "."
+composite -gravity north "$tmpdir"/temp-top-text.png "$tmpdir"/shitpost-temp-resize.png "$tmpdir"/shitpost-temp-composite.png
+printf "."
+composite -gravity south "$tmpdir"/temp-bottom-text.png "$tmpdir"/shitpost-temp-composite.png "$output_file"
+printf ".\n"

-#Clean up
-rm temp-top-text.png
-rm temp-bottom-text.png
-rm shitpost-temp-resize.png
-rm shitpost-temp-composite.png

 #Announce the results
-echo "Created file "$PWD"/shitpost-"$pref"."$fext""
+echo "Created file $output_file"

 exit 0
\ No newline at end of file