CN110545427A - PDF document compression method and device and electronic equipment - Google Patents

PDF document compression method and device and electronic equipment Download PDF

Info

Publication number
CN110545427A
CN110545427A CN201810524824.7A CN201810524824A CN110545427A CN 110545427 A CN110545427 A CN 110545427A CN 201810524824 A CN201810524824 A CN 201810524824A CN 110545427 A CN110545427 A CN 110545427A
Authority
CN
China
Prior art keywords
original image
image
size
compressed
width
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810524824.7A
Other languages
Chinese (zh)
Inventor
邓斌
章庆元
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Guangzhou Jinshan Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Jinshan Mobile Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Jinshan Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201810524824.7A priority Critical patent/CN110545427A/en
Publication of CN110545427A publication Critical patent/CN110545427A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/04Protocols for data compression, e.g. ROHC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The embodiment of the invention provides a PDF document compression method, a device and electronic equipment, and relates to the technical field of data processing, wherein the method comprises the following steps: obtaining the size of each original image in the PDF file; selecting an original image meeting a preset definition condition from all original images as an original image to be compressed; determining the target size of each original image to be compressed according to the preset definition condition; and compressing each original image to be compressed to the corresponding target size. The invention can effectively compress the PDF document with the picture by taking the compression effect and the image definition into consideration.

Description

PDF document compression method and device and electronic equipment
Technical Field
The invention relates to the technical field of data processing, in particular to a PDF document compression method and device and electronic equipment.
background
portable Document Format (PDF) is a unique cross-platform file Format, which is a foreign language abbreviation of Portable Document Format, and can encapsulate all information of text, Format, font, color, resolution, link, graphic image, sound, dynamic image, etc. of a Document into a special integrated file. People often need to compress PDF documents because they want to transmit data quickly and do not like a lot of space occupation. The method is a technical method for reducing the data volume to reduce the storage space and improve the transmission, storage and processing efficiency of the data on the premise of not losing useful information, or reorganizing the data according to a certain algorithm and reducing the redundancy and storage space of the data.
however, the inventor finds that the prior art has at least the following problems in the process of implementing the invention:
The traditional document compression methods mainly include the following two methods:
ZIP compression is well suited for images with large areas of a single color or repeating pattern, as well as black and white images containing repeating patterns. Acrobat supports only 8-bit ZIP compression, which is "lossless"; it does not delete data to reduce the file size so the image quality is not affected, but the compressed file size is still large.
JPEG compression is suitable for grayscale or color images, such as tone-continuous photographs. JPEG is a "lossy" compression, that is, it deletes image data and may degrade image quality, which attempts to reduce file size with minimal loss of information. Since JPEG compression deletes data, it may generate a file of a much smaller size than ZIP compression, but may affect the sharpness of an image.
therefore, the PDF document compression method in the prior art cannot effectively compress the PDF document with the picture by taking the compression effect and the image definition into consideration.
Disclosure of Invention
The embodiment of the invention aims to provide a document compression method and a document compression device so as to effectively compress a PDF document with a picture by taking the compression effect and the image definition into consideration. The specific technical scheme is as follows:
In a first aspect, a PDF document compression method is provided, where the method includes:
Obtaining the size of each original image in the PDF file;
selecting an original image meeting a preset definition condition from all original images as an original image to be compressed;
determining the target size of each original image to be compressed according to the preset definition condition;
And compressing each original image to be compressed to the corresponding target size.
Optionally, the method further includes: obtaining image display information in a PDF file, wherein the image display information comprises the display size of each image;
The method comprises the following steps of selecting an original image meeting a preset definition condition from all original images as an original image to be compressed, wherein the steps comprise:
And determining the original image to be compressed which meets the preset definition condition from all the original images according to the display size of each image and the size of each original image.
Optionally, the step of determining, from each original image according to the display size of each image and the size of each original image, an original image to be compressed that satisfies the preset sharpness condition includes:
Calculating the proportion between the size of each original image and the image display size of the original image as the resolution of the original image;
determining each original image with the resolution ratio larger than a preset threshold value as an original image to be compressed meeting a preset definition condition;
The step of determining the size of the compressed target of each original image to be compressed according to a preset definition condition comprises the following steps:
and calculating each original image to be compressed according to the preset threshold value to obtain the compressed target size of each original image to be compressed.
Optionally, the step of calculating a ratio between the size of each original image and the image display size thereof as the resolution of the original image includes:
dividing the width of each original image by the width of a display image of the image under the condition of 100% display proportion of the document to obtain the proportion between the size of each original image and the image display size of the original image, wherein the proportion is used as the resolution of the original image; wherein the width is a length in a horizontal direction.
Optionally, the step of calculating to obtain the compressed target size of each original image to be compressed includes:
Calculating the width of the original image multiplied by a preset threshold value to be divided by the resolution ratio to obtain a target width and rounding; wherein the width is a length in a horizontal direction;
calculating the target height in an equal ratio and rounding mode according to the ratio of the width to the height of the original image and the width of the target image; wherein the height is a length in a vertical direction.
Optionally, the step of compressing each original image to be compressed to its corresponding target size includes:
And (3) reducing the size of each original image to be compressed to the corresponding target size proportionally by adopting an adjacent sampling algorithm.
in a second aspect, there is provided a PDF document compression apparatus, the apparatus comprising:
The obtaining module is used for obtaining the size of each original image in the PDF file;
The selection module is used for selecting the original image meeting the preset definition condition from all the original images as the original image to be compressed;
the determining module is used for determining the target size of each original image to be compressed according to the preset definition condition;
And the compression module is used for compressing each original image to be compressed to the corresponding target size.
Optionally, the apparatus further comprises: the device comprises an image display obtaining module, a display processing module and a display processing module, wherein the image display obtaining module is used for obtaining image display information in a PDF file, and the image display information comprises the display size of each image;
The selection module is specifically configured to determine, from each original image, an original image to be compressed that satisfies the preset sharpness condition according to a display size of each image and a size of each original image.
Optionally, the selecting module includes: the device comprises a resolution calculation unit and an image to be compressed determination unit;
The resolution calculation unit is used for calculating the proportion between the size of each original image and the image display size of the original image as the resolution of the original image;
the image to be compressed determining unit is used for determining each original image with the resolution ratio larger than a preset threshold value as an original image to be compressed meeting a preset definition condition;
the determining module is specifically configured to calculate each original image to be compressed according to the preset threshold, and obtain a target size of each original image to be compressed after compression.
optionally, the resolution calculating unit is specifically configured to:
Dividing the width of each original image by the width of a display image of the image under the condition of 100% display proportion of the document to obtain the proportion between the size of each original image and the image display size of the original image, wherein the proportion is used as the resolution of the original image; wherein the width is a length in a horizontal direction.
Optionally, the determining module includes: a target width calculation unit and a target height calculation unit;
The target width calculation unit is used for calculating the original image width multiplied by a preset threshold value to be divided by the resolution ratio to obtain a target width and rounding the target width; wherein the width is a length in a horizontal direction;
the target height calculating unit is used for calculating the target height in an equal ratio according to the ratio of the width to the height of the original image and the width of the target image; wherein the height is a length in a vertical direction.
optionally, the compression module is specifically configured to:
and (3) reducing the size of each original image to be compressed to the corresponding target size proportionally by adopting an adjacent sampling algorithm.
In a third aspect, an electronic device is provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus;
A memory for storing a computer program;
A processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
in yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any one of the above-mentioned PDF document compression methods.
In another aspect of the present invention, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any one of the above-mentioned PDF document compression methods.
the embodiment of the invention provides a PDF document compression method, a device and electronic equipment, which can compress an original image meeting a preset definition condition in a PDF file. Therefore, the method and the device can only compress the original image meeting the preset definition condition, not only maintains the definition of the image, but also can compress the PDF document to a proper size, thereby effectively compressing the PDF document with the image by taking the compression effect and the image definition into consideration.
Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
drawings
in order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flow chart of a PDF document compression method according to an embodiment of the present invention;
FIG. 2 is another flow chart of a PDF document compression method according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a PDF document compression device according to an embodiment of the present invention;
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a PDF document compression method which can be realized by electronic equipment.
In the embodiment of the present invention, the electronic device may be any electronic device capable of processing a PDF format file, such as a computer, a mobile phone, and a tablet computer.
as shown in fig. 1, the method may include the steps of:
step 101, obtaining the size of each original image in the PDF file.
In one implementation, the PDF document includes an original image file, where attribute information of an image is stored in the original image file, where the attribute information includes an image size, and the electronic device may obtain the image size from the original image file.
and 102, selecting an original image meeting a preset definition condition from all original images as an original image to be compressed.
In one implementation, the a4 paper width is about 8 inches, and an original image with a value of greater than 225pixel/inch obtained by dividing the original image width by 8 inches may be determined as the image to be compressed, that is, the preset definition condition may be set to have an original image width greater than 1800pixel, and an original image with a width greater than 1800pixel may be determined as the original image to be compressed.
and 103, determining the target size of each original image to be compressed according to the preset definition condition.
in one implementation, the target size may be 1800 pixels by 225 x 8 x 1800 pixels.
and 104, compressing each original image to be compressed to the corresponding target size.
In one implementation, pixels of an image may be scaled down to a corresponding target size.
The PDF document compression method provided by the embodiment of the invention can be used for compressing the original image meeting the preset definition condition in the PDF document. Therefore, the method and the device can only compress the original image meeting the preset definition condition, not only maintains the definition of the image, but also can compress the PDF document to a proper size, thereby effectively compressing the PDF document with the image by taking the compression effect and the image definition into consideration.
referring to fig. 2, fig. 2 is another flowchart of a PDF document compression method according to an embodiment of the present invention.
Step 201, obtaining image display information in the PDF file, where the image display information includes each image display size.
In one implementation, image display information in a PDF file is obtained by an electronic device, where the image display information includes position information of image display and image display size.
step 202, the size of each original image in the PDF file is obtained.
Step 203, determining an original image to be compressed according to the display size of each image and the size of each original image.
Specifically, first, a ratio between the size of each original image and the image display size thereof is calculated as the resolution of the original image; and determining each original image with the resolution ratio larger than a preset threshold value as an original image to be compressed. In this embodiment, each original image with a resolution greater than a preset threshold is an original image that meets a preset definition condition and is used as an original image to be compressed.
specifically, under the condition of 100% display proportion of the document, dividing the width of each original image by the width of the displayed image of the image to obtain the proportion between the size of each original image and the image display size of the original image, wherein the proportion is used as the resolution of the original image; wherein the width is a length in a horizontal direction.
in one implementation, the resolution (Pixels Per inc, PPI) is calculated as:
the unit of the original image is a pixel, and the unit of the image display is an inch.
For example, if the original image size is 450 × 450 pixels, the image display size is 30 × 30point, where 72point equals 1inch, and the resolution of the image is 450/30 × 72 — 1080 pixels/inch.
in one implementation, the threshold is set to 225pixel/inch, the same file is compressed at different resolutions, and multiple tests show that when the resolution is greater than 225pixel/inch, human eyes cannot see the difference between the displayed image and the original image at the display scale of 100% of the document.
and step 204, calculating to obtain the compressed target size of each original image to be compressed.
Specifically, each original image to be compressed may be calculated according to the preset threshold, so as to obtain a target size of each original image to be compressed after compression.
specifically, the original image width multiplied by a preset threshold value divided by the resolution may be calculated to obtain a target width and rounded; wherein the width is a length in a horizontal direction;
Calculating the target height in an equal ratio according to the ratio of the width to the height of the original image and the width of the target image; wherein the height is a length in a vertical direction.
In one implementation, the target width is calculated by the formula:
the calculation formula of the target height is as follows:
for example, the original image size is 450 × 450 pixels, the resolution of the image is 1080 pixels/inch, and is greater than 225 pixels/inch, and then the target width is calculated: and (3) taking an integer of 450 × 225/1080 to 93.75 pixels to obtain a target width of 94 pixels, calculating the target height according to the ratio of the width to the height of the original image and the target width, and taking the integer: 450 × 94/450 ═ 94 pixels.
Step 205, compress each original image to be compressed to its corresponding target size.
Specifically, the size of each original image to be compressed is reduced to the corresponding target size proportionally by adopting an adjacent sampling algorithm.
for example, if the original image size is reduced to 1/2, one pixel point can be selected from two adjacent pixel points; if the original image size is reduced to 1/3, every three pixels can be grouped into one group, and one pixel is arbitrarily selected from each group of pixels.
Of course, other compression algorithms, such as a reduced pixel sampling method, may be used.
therefore, by applying the method provided by the embodiment of the invention, the original image to be compressed can be determined by the electronic equipment, and the original image to be compressed is compressed to the target size based on the image resolution, so that the definition of the image is kept, the PDF document can be effectively compressed, and the use is convenient.
due to the same technical concept, corresponding to the embodiment of the method shown in fig. 1, the embodiment of the present invention further provides a PDF document compression apparatus, as shown in fig. 3, the apparatus includes:
an obtaining module 301, configured to obtain the size of each original image in a PDF file;
a selecting module 302, configured to select, from the original images, an original image that meets a preset definition condition as an original image to be compressed;
a determining module 303, configured to determine a target size of each original image to be compressed according to the preset definition condition;
and a compression module 304, configured to compress each original image to be compressed to its corresponding target size.
Specifically, the apparatus further comprises: the device comprises an image display obtaining module, a display processing module and a display processing module, wherein the image display obtaining module is used for obtaining image display information in a PDF file, and the image display information comprises the display size of each image;
The selection module is specifically configured to determine, from each original image, an original image to be compressed that satisfies the preset sharpness condition according to a display size of each image and a size of each original image.
Specifically, the selecting module includes: the device comprises a resolution calculation unit and an image to be compressed determination unit;
the resolution calculation unit is used for calculating the proportion between the size of each original image and the image display size of the original image as the resolution of the original image;
the image to be compressed determining unit is used for determining each original image with the resolution ratio larger than a preset threshold value as an original image to be compressed meeting a preset definition condition;
The determining module is specifically configured to calculate each original image to be compressed according to the preset threshold, and obtain a target size of each original image to be compressed after compression.
specifically, the resolution calculation unit is specifically configured to:
Dividing the width of each original image by the width of a display image of the image under the condition of 100% display proportion of the document to obtain the proportion between the size of each original image and the image display size of the original image, wherein the proportion is used as the resolution of the original image; wherein the width is a length in a horizontal direction.
specifically, the determining module includes: a target width calculation unit and a target height calculation unit;
the target width calculation unit is used for calculating the original image width multiplied by a preset threshold value to be divided by the resolution ratio to obtain a target width and rounding the target width; wherein the width is a length in a horizontal direction;
The target height calculating unit is used for calculating the target height in an equal ratio according to the ratio of the width to the height of the original image and the width of the target image; wherein the height is a length in a vertical direction.
specifically, the compression module is specifically configured to:
and (3) reducing the size of each original image to be compressed to the corresponding target size proportionally by adopting an adjacent sampling algorithm.
The PDF document compression device provided by the embodiment of the invention can compress the original image meeting the preset definition condition in the PDF file. Therefore, the method and the device can only compress the original image meeting the preset definition condition, not only maintains the definition of the image, but also can compress the PDF document to a proper size, thereby effectively compressing the PDF document with the image by taking the compression effect and the image definition into consideration.
an embodiment of the present invention further provides an electronic device, as shown in fig. 4, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404,
A memory 403 for storing a computer program;
The processor 401, when executing the program stored in the memory 403, implements the following steps:
obtaining the size of each original image in the PDF file;
Selecting an original image meeting a preset definition condition from all original images as an original image to be compressed;
Determining the target size of each original image to be compressed according to the preset definition condition;
And compressing each original image to be compressed to the corresponding target size.
The embodiment of the invention provides PDF document compression electronic equipment which can compress an original image meeting a preset definition condition in a PDF file. Therefore, the method and the device can only compress the original image meeting the preset definition condition, not only maintains the definition of the image, but also can compress the PDF document to a proper size, thereby effectively compressing the PDF document with the image by taking the compression effect and the image definition into consideration.
the communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
the Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a network Processor (Ne word Processor, NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In another embodiment of the present invention, a computer-readable storage medium is further provided, which stores instructions that, when executed on a computer, cause the computer to execute the PDF document compression method described in any of the above embodiments.
in yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the PDF document compression method described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
all the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for embodiments of devices, electronic devices, and the like, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
the above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (13)

1. a portable document format PDF document compression method is characterized by comprising the following steps:
obtaining the size of each original image in the PDF file;
selecting an original image meeting a preset definition condition from all original images as an original image to be compressed;
Determining the target size of each original image to be compressed according to the preset definition condition;
and compressing each original image to be compressed to the corresponding target size.
2. the method of claim 1, wherein:
the method further comprises the following steps: obtaining image display information in a PDF file, wherein the image display information comprises the display size of each image;
The method comprises the following steps of selecting an original image meeting a preset definition condition from all original images as an original image to be compressed, wherein the steps comprise:
and determining the original image to be compressed which meets the preset definition condition from all the original images according to the display size of each image and the size of each original image.
3. the method of claim 2, wherein:
the step of determining the original image to be compressed which meets the preset definition condition from each original image according to the display size of each image and the size of each original image comprises the following steps:
calculating the proportion between the size of each original image and the image display size of the original image as the resolution of the original image;
determining each original image with the resolution ratio larger than a preset threshold value as an original image to be compressed meeting a preset definition condition;
The step of determining the size of the compressed target of each original image to be compressed according to a preset definition condition comprises the following steps:
And calculating each original image to be compressed according to the preset threshold value to obtain the compressed target size of each original image to be compressed.
4. The method of claim 3, wherein the step of calculating a ratio between the size of each original image and the image display size thereof as the resolution of the original image comprises:
Dividing the width of each original image by the width of a display image of the image under the condition of 100% display proportion of the document to obtain the proportion between the size of each original image and the image display size of the original image, wherein the proportion is used as the resolution of the original image; wherein the width is a length in a horizontal direction.
5. The method according to claim 3, wherein the step of calculating the target size after obtaining the compression of each original image to be compressed comprises:
multiplying the width of the original image by a preset threshold value and dividing the width by the resolution to obtain a target width and rounding; wherein the width is a length in a horizontal direction;
Calculating the target height in an equal ratio and rounding mode according to the ratio of the width to the height of the original image and the width of the target image; wherein the height is a length in a vertical direction.
6. The method of claim 1, wherein the step of compressing each original image to be compressed to its corresponding target size comprises:
And (3) reducing the size of each original image to be compressed to the corresponding target size proportionally by adopting an adjacent sampling algorithm.
7. A PDF document compression apparatus comprising:
the obtaining module is used for obtaining the size of each original image in the PDF file;
the selection module is used for selecting the original image meeting the preset definition condition from all the original images as the original image to be compressed;
the determining module is used for determining the target size of each original image to be compressed according to the preset definition condition;
and the compression module is used for compressing each original image to be compressed to the corresponding target size.
8. The apparatus of claim 7, wherein:
the device further comprises: the device comprises an image display obtaining module, a display processing module and a display processing module, wherein the image display obtaining module is used for obtaining image display information in a PDF file, and the image display information comprises the display size of each image;
The selection module is specifically configured to determine, from each original image, an original image to be compressed that satisfies the preset sharpness condition according to a display size of each image and a size of each original image.
9. The apparatus of claim 8, wherein:
the selection module comprises: the device comprises a resolution calculation unit and an image to be compressed determination unit;
the resolution calculation unit is used for calculating the proportion between the size of each original image and the image display size of the original image as the resolution of the original image;
The image to be compressed determining unit is used for determining each original image with the resolution ratio larger than a preset threshold value as an original image to be compressed meeting a preset definition condition;
the determining module is specifically configured to calculate each original image to be compressed according to the preset threshold, and obtain a target size of each original image to be compressed after compression.
10. the apparatus according to claim 9, wherein the resolution calculation unit is specifically configured to:
Dividing the width of each original image by the width of a display image of the image under the condition of 100% display proportion of the document to obtain the proportion between the size of each original image and the image display size of the original image, wherein the proportion is used as the resolution of the original image; wherein the width is a length in a horizontal direction.
11. The apparatus of claim 9, wherein the determining module comprises: a target width calculation unit and a target height calculation unit;
the target width calculation unit is used for calculating the original image width multiplied by a preset threshold value to be divided by the resolution ratio to obtain a target width and rounding the target width; wherein the width is a length in a horizontal direction;
The target height calculating unit is used for calculating the target height in an equal ratio according to the ratio of the width to the height of the original image and the width of the target image; wherein the height is a length in a vertical direction.
12. the apparatus of claim 7, wherein the compression module is specifically configured to:
And (3) reducing the size of each original image to be compressed to the corresponding target size proportionally by adopting an adjacent sampling algorithm.
13. an electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
A processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
CN201810524824.7A 2018-05-28 2018-05-28 PDF document compression method and device and electronic equipment Pending CN110545427A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810524824.7A CN110545427A (en) 2018-05-28 2018-05-28 PDF document compression method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810524824.7A CN110545427A (en) 2018-05-28 2018-05-28 PDF document compression method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN110545427A true CN110545427A (en) 2019-12-06

Family

ID=68700861

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810524824.7A Pending CN110545427A (en) 2018-05-28 2018-05-28 PDF document compression method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110545427A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112783840A (en) * 2020-06-08 2021-05-11 北京金山办公软件股份有限公司 Method and device for storing document, electronic equipment and storage medium
CN113068043A (en) * 2020-01-02 2021-07-02 武汉金山办公软件有限公司 PNG image compression method and device, electronic equipment and storage medium
CN113994708A (en) * 2020-05-28 2022-01-28 深圳市大疆创新科技有限公司 Encoding method, decoding method, device and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060115169A1 (en) * 2004-12-01 2006-06-01 Ohk Hyung-Soo Apparatus for compressing document and method thereof
CN101331480A (en) * 2005-12-15 2008-12-24 微软公司 Compressing images in documents
JP2014147051A (en) * 2013-01-30 2014-08-14 Dainippon Printing Co Ltd Compression apparatus of electronic document image
CN105489194A (en) * 2015-11-24 2016-04-13 小米科技有限责任公司 Method and device for displaying images
CN105721810A (en) * 2014-12-05 2016-06-29 北大方正集团有限公司 Image compression storage method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060115169A1 (en) * 2004-12-01 2006-06-01 Ohk Hyung-Soo Apparatus for compressing document and method thereof
CN101331480A (en) * 2005-12-15 2008-12-24 微软公司 Compressing images in documents
JP2014147051A (en) * 2013-01-30 2014-08-14 Dainippon Printing Co Ltd Compression apparatus of electronic document image
CN105721810A (en) * 2014-12-05 2016-06-29 北大方正集团有限公司 Image compression storage method and apparatus
CN105489194A (en) * 2015-11-24 2016-04-13 小米科技有限责任公司 Method and device for displaying images

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113068043A (en) * 2020-01-02 2021-07-02 武汉金山办公软件有限公司 PNG image compression method and device, electronic equipment and storage medium
CN113068043B (en) * 2020-01-02 2024-04-30 武汉金山办公软件有限公司 PNG image compression method and device, electronic equipment and storage medium
CN113994708A (en) * 2020-05-28 2022-01-28 深圳市大疆创新科技有限公司 Encoding method, decoding method, device and system
CN112783840A (en) * 2020-06-08 2021-05-11 北京金山办公软件股份有限公司 Method and device for storing document, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11681745B2 (en) Digital image presentation
CN110163786B (en) Method, device and equipment for removing watermark
CN110363753B (en) Image quality evaluation method and device and electronic equipment
CN110545427A (en) PDF document compression method and device and electronic equipment
US10594890B2 (en) Compressing each object in an electronic document
CN108322789B (en) Network picture display method and device and mobile terminal
CN111145202B (en) Model generation method, image processing method, device, equipment and storage medium
US12008034B2 (en) Digital image presentation
CN110807300A (en) Image processing method and device, electronic equipment and medium
CN112445394A (en) Screenshot method and device
CN111127310B (en) Image processing method and device, electronic equipment and storage medium
CN115471477A (en) Scanning data denoising method, scanning device, scanning equipment and medium
CN111009017B (en) Picture compression method and device, storage medium and computer equipment
CN111461964B (en) Picture processing method, device, electronic equipment and computer readable medium
CN115880416A (en) Three-dimensional model display method and device, server and storage medium
CN111402276B (en) Binary image generation method and device, electronic equipment and readable storage medium
CN113032696A (en) Display method and display device of page picture
JP2016158223A (en) Image compression device, image compression method and image compression program
CN110795914A (en) Method and device for converting PDF document into picture and electronic equipment
CN113112395B (en) Picture processing method, device and storage medium
CN116168442B (en) Sample image generation method, model training method and target detection method
CN110543624B (en) Method and device for identifying check boxes in PDF document and electronic equipment
CN109976601B (en) Common screen display window segmentation method and system
KR20220060400A (en) Method and apparatus for restoring low resolution image
CN113222815A (en) Image adjusting method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20191206

RJ01 Rejection of invention patent application after publication