-1

I have the following convert command in bash.

    convert "$WALLPAPER1" -resize "${H[0]}"x"${V[0]}"^ -gravity center -crop "${H[0]}"x"${V[0]}"+0+0 "$WALLPAPERS/.temp1.jpg"
    convert "$WALLPAPER2" -resize "${H[1]}"x"${V[1]}"^ -gravity center -crop "${H[1]}"x"${V[1]}"+0+0 jpg:- |
    convert "$WALLPAPERS/.temp1.jpg" - +append "$WALLPAPERS/.temp.jpg"

Is there a way I can get rid of the "$WALLPAPERS/.temp1.jpg" intermediary? So is there a way to carry over the output of the first convert over to the input of the third convert?

deanresin
  • 1,466
  • 2
  • 16
  • 31
  • maybe you can use `process-groups`, like `{ convert WP1 ... ; convert WP2 ...; } | convert WP/temp1.jpg - ...` ? Process-groups (defined inside of `{ ...; ...; ...n;}`) combine all std-output and present it to the next reader in the pipeline. Good luck. – shellter Apr 26 '16 at 04:16
  • Interesting... I found a way writing my intermediaries to *memory-program-registers* calling convert only once. I will look into `process-groups` and try and see which is more efficient && intuitive. – deanresin Apr 26 '16 at 04:53

1 Answers1

1
convert "$WALLPAPER1" -resize "${H[0]}"x"${V[0]}"^ -gravity center -crop "${H[0]}"x"${V[0]}"+0+0 -write mpr:temp1 +delete \
"$WALLPAPER2" -resize "${H[1]}"x"${V[1]}"^ -gravity center -crop "${H[1]}"x"${V[1]}"+0+0 -write mpr:temp2 +delete \
-gravity north mpr:temp1 mpr:temp2 +append "$WALLPAPERS/.temp.jpg"

There was no need to have 3 convert calls. Instead of writing to file you can write to memory-program-register (mpr) and then recall later. The +delete deletes the original image.

deanresin
  • 1,466
  • 2
  • 16
  • 31