Basic principles and methods for adding PDF file contrast

Source: Internet
Author: User

 

The picture above is not an alien, but a famous parrot. The photo below is a graduation souvenir for graduate students. It was carved by a laser from the dragon.

Recent photos are taken at [http://www.douban.com/photos/album/134230762/].


The e-book scan version is similar to the photo version. One possible problem is that it looks abrupt, black is not black enough, and white is not white enough. It looks like a fog. The image fog can be removed by using the luck function of Picasa or the automatic function of snapseed. However, I did not find the software that used the same features on PDF.


However, if I understand the principle, I think of Yang Zushi in the legend of the Yi Tian dragon slaughter. The tactics of various weapons such as the long-running knife, the moth, And the thorn can be integrated into the boxing method.

In terms of Black and White (strictly speaking, grayscale) images, the basic principle of "defog" is to increase the contrast. The full black, full White, and all the transitional tones seen by the human eye are represented by numbers in computer images. Human eyes are very precise and have a great range of optical instruments, from Bright to looking at the sun, to the dark seat number in the cinema, you can see. Computer images only show a very small part of the human eye's tolerable range. The most important information in this section (all for black and white images) is the brightness. A Computer Image uses the size of a number to indicate the brightness. the brighter the brightness, that is, the more white the image is, the larger the number, the darker the brightness, that is, the blacker the image, it is represented by a small number.

In this way, for example, each pixel in an image, from the shortest to the brightest, corresponds to a number ranging from 0 to 255. Gamma Correction in various image processing software is used to specify the corresponding relationship. This kind of correspondence may be linear or non-linear. In non-linear situations, numbers may change a lot, while brightness changes very little-similar to the hot and cold water when you take a bath, after twisting for a long time, it was still quite cool, and suddenly it was so hot that it could burn rupi. Do you think this is not a problem? Yes, this kind of non-linearity can sometimes cause trouble, but it also has the advantage of good recognition.

We define a value that is lower than it is black, no matter how the value changes; specify a value that is higher than it is white, no matter how the value changes. The two values are black to gray and gray to white. The reason why we are less than a certain number is regarded as black because we may not want to present the details of this dark tone. The reason why we are higher than a certain number is regarded as full White, because we may want to present these as highlights.

The captured reality is one thing. How to present it is completely different. The second Cat asked yesterday why there are few scary things written in the book. I said that if Cinderella's story is completely realistic, most of the time you see it is not the prince's dance and dancing shoes, but Cinderella cooks for her stepmother and later sisters all day long ...... Cooking

Similarly, if a PDF e-book is improperly scanned, it may show too many dark and highlight details, while the gray tone's transition level is not clear enough. You can adjust the black and white thresholds for the dark part and highlight ranges. Next, we will continue to introduce them. The gray tone transition level can be completed by fine-tuning Gamma Correction, which is not discussed in this article, please learn by yourself.

Therefore, to increase the contrast of a misty ebook, the principle is to reset the black and white thresholds. The above is the principle part, and the following is the operation method.

Some people said that they would export all the images in the PDF, use Photoshop to adjust the gamma or set the black and white thresholds, and then import them to the PDF. This is exactly how it works, but it requires the installation of high-end charging tools Photoshop and Acrobat professional. It may also require one page at a time (?) Some of them mean that they are used as a cow. The following describes the batch processing method.

Sample in step 1 and convert the PDF into an image using ImageMagick. In fact, we only need one or two of them, but I don't know how to do it. ImageMagick is a tool available in both Linux and Windows. It supports command lines.

$ Convert 1.pdf 1.jpg

In this way, a large number of JPG images are obtained.

Step 1: Use gimp to determine the white and black thresholds. You can also use gimp and Photoshop. Anyone who can adjust the grayscale image threshold can do the same. It feels best to adjust it to you. Yes, it is "feeling". This is a subjective standard. Then write down the white and black thresholds. Gimp is Photoshop in Linux.

If you do not perform the preceding two steps, the following thresholds can be guessed, experienced, or tried multiple times.

Step 2 Use ImageMagick to modify the contrast

$ Convert-level 38%, 99% 1.pdf 2.pdf

This line of command means: less than, as black, higher than, as white, the source file 1.pdfis converted to the target file 2.pdf.

Because the Gamma line is automatically adjusted while the threshold is adjusted to make it steep, the level of the gray tone is clearer.


The principle has been explained a lot, but it is just a brief introduction. What actually works in a method is just a line of command. Therefore, this story tells us that it is much easier to know how to do it, but it is much harder to know why it is successful. Of course, only in this way can we use the kung fu of the long-running big-knife moth and eyebrow thorn in the hands of the boxing method. Or, only in this way can we apply the shadow perspective and color model to the makeup.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.