Difference between revisions of "Linux commands"

From Organic Design wiki
m
Line 1: Line 1:
 
I'm starting a list of useful linux shell commands (generally "one liners") we use a lot
 
I'm starting a list of useful linux shell commands (generally "one liners") we use a lot
  
== Apply an opaque background of a specified colour to a directory of transparent PNG's ==
+
== Image Manipulation ==
 +
 
 +
=== Resizing JPG's and changing quality setting ===
 +
The first line shows how to reduce and image to 25% and quality to 50% adding "_resized" to the results filename. The second command uses Perl to apply this same command to all JPG's in the current directory.
 +
{{code|<bash>
 +
convert foo.jpg -resize 25% -quality 50% foo_resized.jpg
 +
 
 +
perl -e 'for (glob "*.jpg") { $img = $_; s/(....)$/_resized$1/; qx "convert $img -resize 25% -quality 50% $_"; }'
 +
</bash>}}
 +
 
 +
=== Apply an opaque background of a specified colour to a directory of transparent PNG's ===
 
*This command requires ImageMagick to be installed
 
*This command requires ImageMagick to be installed
 
*It loops through all PNG's in the CWD and puts them in a directory called ''processed'' which must exist
 
*It loops through all PNG's in the CWD and puts them in a directory called ''processed'' which must exist

Revision as of 23:55, 20 April 2008

I'm starting a list of useful linux shell commands (generally "one liners") we use a lot

Image Manipulation

Resizing JPG's and changing quality setting

The first line shows how to reduce and image to 25% and quality to 50% adding "_resized" to the results filename. The second command uses Perl to apply this same command to all JPG's in the current directory.

{{{1}}}

Apply an opaque background of a specified colour to a directory of transparent PNG's

  • This command requires ImageMagick to be installed
  • It loops through all PNG's in the CWD and puts them in a directory called processed which must exist
<bash>

perl -e 'qx "convert $_ -background #ff00ff -flatten foo/$_" for glob "*.png"' </bash>