mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
20141208-3 选题
This commit is contained in:
parent
177246828d
commit
1903cc9b55
@ -0,0 +1,44 @@
|
||||
Linux FAQs with Answers--How to crop an image from the command line on Linux
|
||||
================================================================================
|
||||
> **Question**: I would like to get rid of white margins of an image file. Is there an easy way to crop an image file from the command line on Linux?
|
||||
|
||||
When it comes to converting or editing images files on Linux, ImageMagick is undoubtedly one of the best known all-in-one image software. It boasts of a suite of command-line tools to display, convert, or manipulate more than 200 types of raster or vector image files, all from the command line. ImageMagick can be used for a variety of image editing tasks, such as converting file format, adding special effects, adding text, and transforming (resize, rotate, flip, crop) images.
|
||||
|
||||
If you want to crop an image to trim its margins, you can use two command-line utilities that come with ImageMagick. If you haven't installed ImageMagick, follow [this guideline][1] to install it.
|
||||
|
||||
In this tutorial, let's crop the following PNG image. We want to get rid of the right and bottom margins of the image, so that the chart will be centered.
|
||||
|
||||
![](https://farm8.staticflickr.com/7562/15688242319_ed19aca3a2_z.jpg)
|
||||
|
||||
First, identify the dimension (width and height) of the image file. You can use identify command for that.
|
||||
|
||||
$ identify chart.png
|
||||
|
||||
----------
|
||||
|
||||
chart.png PNG 1500x1000 1500x1000+0+0 8-bit DirectClass 31.7KB 0.000u 0:00.000
|
||||
|
||||
As shown above, the input image is 1500x1000px.
|
||||
|
||||
Next, determine two things for image cropping: (1) the position at which the cropped image will start, and (2) the size of the cropped rectangle.
|
||||
|
||||
In this example, let's assume that the cropped image starts at top left corner, more specifically at x=20px and y=10px, and that the size of a cropped image will be 1200x700px.
|
||||
|
||||
The utility used to crop an image is convert. With "-crop" option, the convert command cuts out a rectangular region of an input image.
|
||||
|
||||
$ convert chart.png -crop 1200x700+20+10 chart-cropped.png
|
||||
|
||||
Given the input image chart.png, the convert command will store the cropped image as chart-cropped.png.
|
||||
|
||||
![](https://farm8.staticflickr.com/7527/15872271461_401276e072_z.jpg)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/crop-image-command-line-linux.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://ask.xmodulo.com/install-imagemagick-linux.html
|
@ -0,0 +1,42 @@
|
||||
Linux FAQs with Answers--How to disable Apport internal error reporting on Ubuntu
|
||||
================================================================================
|
||||
> **Question**: On Ubuntu desktop, I often encounter a popup window, alerting that Ubuntu has experienced an internal error, and asking me to send an error report. This is bothering me as it keeps popping up for every application crash. How can I turn off the error reporting feature?
|
||||
|
||||
Ubuntu desktop comes with Apport pre-installed, which is a system that catches applications crashes, unhandled exceptions or any non-crash application bugs, and automatically generates a crash report for debugging purposes. When an application crash or bug is detected, Apport alerts user of the event by showing a popup window and asking the user to submit a crash report. You will see messages like the following.
|
||||
|
||||
- "Sorry, the application XXXX has closed unexpectedly."
|
||||
- "Sorry, Ubuntu XX.XX has experienced an internal error."
|
||||
- "System program problem detected."
|
||||
|
||||
![](https://farm9.staticflickr.com/8635/15688551119_708b23b12a_z.jpg)
|
||||
|
||||
If application crashes are recurring, frequent error reporting alerts can be disturbing. Or you may be worried that Apport can collect and upload any sensitive information of your Ubuntu system. Whatever the reason is, you may want to disable Apport's error reporting feature.
|
||||
|
||||
### Disable Apport Error Reporting Temporarily ###
|
||||
|
||||
If you want to disable Apport temporarily, use this command:
|
||||
|
||||
$ sudo service apport stop
|
||||
|
||||
Note that Apport will be enabled back after you boot your Ubuntu system.
|
||||
|
||||
### Disable Apport Error Reporting Permanently ###
|
||||
|
||||
To turn off Apport permanently, edit /etc/default/apport with a text editor, and change the content to the following.
|
||||
|
||||
enabled=0
|
||||
|
||||
Now if you reboot your Ubuntu system, Apport will automatically be disabled.
|
||||
|
||||
If you think you will never use Apport, another method is to simply remove it altogether.
|
||||
|
||||
$ sudo apt-get purge apport
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://ask.xmodulo.com/disable-apport-internal-error-reporting-ubuntu.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
Loading…
Reference in New Issue
Block a user