One slight inconvenience to image processing is that it typically is a two-step process: 1) convert an image to an output image, followed by 2) displaying the output image. Then, you repeat these steps until you reach your desired effect.
Not really a big inconvenience, but you can avoid the file storage and simply display the output image directly to the screen. Let's look at an example.
$ convert Downloads/boink.jpg -resize 120% /tmp/foo.jpg
$ display /tmp/foo.jpg
The above commands will grow the input image by 20%.
You can however skip the intermediate file and display the results directly to the screen. This is done by specifying the '-' as the output variable, which represents stdin/stdout. In other words, the following command says to increase the input file by 20% and write the results directly to stdout.
$ convert Downloads/boink.jpg -resize 120% -
But, unless you are fluent in jpg it looks like gobbly-gook, but piping it to something that speaks jpg will suite out needs. Since display is used to display image files, it certainly can render the image. It also allows '-' as a file designator, but in this case 'display -' means display the contents of stdin.
So, chaining the convert (writing to stdout) with the display (reading from stdin) will pipe the output file directly to display, which in turn renders it to the screen.
$ convert Downloads/boink.jpg -resize 120% - | display -
Easy Peazy.
No comments:
Post a Comment