Summary of the invention
The embodiment of the invention provides a kind of color separation processing method and device of image file, in order to solve big, the slow-footed problem of document analysis of conventional images data color separation processing process file data volume.
The color separation processing method of the image file that the embodiment of the invention provides is applied to the publication and printing field, comprising:
Resolve image file, obtain view data;
The color mode required according to color separation carries out color separation processing to said view data; Obtain the corresponding view data of different colours; Said said view data is carried out color separation processing; Be specially: the color mode of the view data that obtains according to parsing directly obtains or obtains through mode switch the multichannel image data of the required color mode of color separation;
The view data that each color is corresponding writes corresponding look version respectively, and generates the PS file according to version of all kinds; Wherein, the view data that each color is corresponding writes corresponding look version respectively, is specially: each channel image data is write the look version corresponding with passage respectively.
The device of the image file color separation processing that the embodiment of the invention provides is applied to the publication and printing field, comprising:
The document analysis module is used to resolve image file, obtains view data;
The image color segmentation module is used for according to the required color mode of color separation said view data being carried out color separation processing, obtains the corresponding view data of different colours; Be further used for, the color mode of the view data that obtains according to parsing directly obtains or obtains through mode switch the multichannel image data of the required color mode of color separation;
File generating module is used for the view data that each color is corresponding and writes corresponding look version respectively, and generates the PS file according to version of all kinds; Said file generating module is further used for, and each channel image data is write the look version corresponding with passage respectively.
The above embodiment of the present invention; Through image file is resolved and color separation processing, obtain the corresponding view data of different colours in the required color mode of color separation, again that each color is corresponding view data writes corresponding look version respectively; Generate the PS file; Version of all kinds only comprises the view data corresponding with this look version in the PS file thereby make, and compares with in of all kinds edition of the PS file of the prior art all images data all being comprised wherein, has reduced the data volume of PS file; And then improved parsing, the processing speed of PS file, and further improved the operating factor of memory space of storage medium.
Embodiment
Below in conjunction with accompanying drawing the embodiment of the invention is described in detail.
Referring to Fig. 1, the schematic flow sheet of the image file color separation processing that provides for the embodiment of the invention.For the needs of colored printing, the required color mode of front end color separation is the CMYK pattern usually, but does not also get rid of the possibility of other color modes, but its handling principle is the same.Be that CMYK is that example is described with the required color mode of front end color separation below, this flow process specifically comprises:
Step 101, extract pending image file (like scanning or the image file that designs and produces out through the picture process software; Like image files such as TIFF, JPEG) relevant information, relevant information can comprise following one or more: image file type (like compressed file, non-compressed file or compress mode etc.), file layout (like TIFF or JPEG etc.), color of image pattern (like binary map, artwork master, key map, gray-scale map, RGB pattern or CMYK pattern etc.).
In this step; Can judge the form of image file according to the filename suffix of image file; As judging that for the image file of file image.GIF by name it is a tiff format; In order to improve the accuracy of judgement, also can judge through the field of relevant document form in the file header of reading images file.For color mode, can judge through the field that reads relevant color mode in the file header.For type, can through reading in the file header relevant whether compress and the field of compress mode is judged.
The relevant information that step 102, basis extract from image file is resolved image file, thereby gets access to view data.
In this step, when resolving the image file process, coded system and the compression that can determine view data according to the form and the type of the image file that extracts parse view data with decoding mode corresponding and decompress(ion) mode then.The color mode of image file has determined the quantity and the type of passage, and the view data that parses can be organized with the pairing hyperchannel form of color mode.For example:
For file layout is that TIFF, color mode are the picture that RGB, view data do not have compression, resolve this image file after, the reads image data content obtains RGB_R, RGB_G, three channel image data of RGB_B.
The color mode of the image file that step 103, basis extract determines whether to carry out mode switch, and if desired, then execution in step 104, otherwise execution in step 105.
In this step; Because when color mode is binary map, artwork master, key map, gray-scale map or CMYK isotype; The view data of its hyperchannel form can be directly corresponding with the multi-channel data of the required CMYK pattern of color separation; Therefore, for the view data of above-mentioned color mode, then need not carry out mode switch.Because color mode is when being the RGB pattern, the view data of its hyperchannel form is can not be directly directly corresponding with the multi-channel data of the required CMYK pattern of color separation, therefore, need the view data of RGB pattern be converted into the required CMYK pattern of color separation.
Step 104, convert view data into the CMYK pattern, that is, obtain the multi-channel data of CMYK pattern.The mode that conversion regime can adopt prior art to provide.For example:
For the image file of RGB pattern, after the mode switch processing, obtain the view data of CMYK pattern, comprise CMYK_C, CMYK_M, CMYK_Y and four channel image data of CMYK_K.
Step 105, CMYK look version of selection, a passage of the corresponding CMYK pattern of each CMYK look version.
The corresponding image channel of look version that whether has and select in the view data that obtains is resolved in step 106, judgement, if having, then execution in step 107, otherwise execution in step 109.
In this step; Because the number of channels of the view data that goes out from the Image File Parser of some color mode is less than the number of channels of CMYK pattern; Like binary map, artwork master, gray-scale map etc., not necessarily exist and the corresponding data channel of selecting of look version for these image files.
Step 107, in the current look version of selecting, write dependent instruction.
The PS instruction is before writing view data in the sensing PS file; Need describe the color space of view data, picture size, picture position, transformation matrix, picture data type, code encoding/decoding mode etc., also will write Flame Image Process instruction (like orders such as the image) PS of etc.ing simultaneously and instruct.PS file for color separation output; In this step, write above-mentioned these whens instruction, owing to only comprise the view data of respective channel in the version of all kinds, thereby the PS instruction when being different from prior art output PS file; Need adjust instruction, may use different parameters or different instructions.
Step 108, in the current look version of selecting, write the view data of respective channel, the view data that writes is for resolving the view data that (as previously mentioned, also needing mode switch in some cases) obtains.
Step 109, judge whether the CMYK look version that do not traverse in addition, if having, then execution in step 110, otherwise generate process ends behind the PS file.
Step 110, the next CMYK look version of selection, and return step 106.
In the above-mentioned flow process; Can travel through each look version in the CMYK look version successively; Thereby in C look version, write the CMYK_C channel image data that parses, in M look version, write the CMYK_M channel image data that parses, in Y look version, write the CMYK_Y channel image data that parses; In K look version, write the CMYK_K channel image data that parses, finally form the PS file.Certainly, under the non-existent situation of certain channel image data, need not write view data in the corresponding look version.
Can find out through above-mentioned flow process, adopt the PS file of above-mentioned color separation output, promptly; Through resolving image file; The different channel image data correspondences that parse are write in four look versions of the required CMYK pattern of front end color separation, and finally form the PS file, thereby make of all kinds edition view data that only comprises respective channel in the PS file; And in the PS file that employing prior art mode is exported; Version of all kinds all comprises whole view data, and is visible, and the method that adopts the embodiment of the invention to provide can significantly reduce the data volume of PS file; And can further improve parsing, processing speed, and the operating factor of memory space that improves storage medium (like disk) to the PS file.To same color document image, after table 1 has provided respectively and has adopted prior art mode and the mode that adopts the embodiment of the invention to provide to handle, the comparison in file size and shared space:
Table 1
? |
The PS file size |
The PS file takes up room |
The prior art mode |
(4.46MB 4,682,253 byte) |
(4.46MB 4,685,824 byte) |
The mode of the embodiment of the invention |
(1.70MB 1,784,205 byte) |
(1.70MB 1,785,856 byte) |
Based on identical technical conceive, the embodiment of the invention also provides a kind of image file color separation processing device.
Referring to Fig. 2, the structural representation of the image file color separation processing device that provides for the embodiment of the invention, this device comprises: document analysis module 21, image color segmentation module 22 and file generating module 23, wherein:
Document analysis module 21 is used to resolve image file and obtains view data, and image file can be scanning or the image file that designs and produces out through the picture process software;
Image color segmentation module 22 is used for according to the required color mode of color separation document analysis module 21 being resolved the view data that obtains and carries out color separation processing, obtains the corresponding view data of different colours;
File generating module 23 is used for the corresponding view data of each color that obtains after image color segmentation module 22 color separation processing is write corresponding look version respectively, and generates the PS file according to version of all kinds.
In said apparatus; Document analysis module 21 can be confirmed the number of channels and the type of this view data through the color mode of reading images file; And reading out the corresponding view data of each passage according to the file layout of this image file and compression type, concrete mode is as previously mentioned.Image color segmentation module 22 is before carrying out color separation processing; Can whether carry out mode switch according to the color mode decision of this view data; As when the required color mode of front end color separation is CMYK; Then the view data for the RGB pattern need be converted into the CMYK pattern, and the view data that when this module is carried out color separation processing, will parse (or after further passing through mode switch) converts the multichannel image data of the required color mode of color separation processing into.File generating module 23 can write each channel image data after image color segmentation module 22 color separation processing respectively the look version corresponding with passage; Thereby finally generate the PS file, for example can in version of all kinds, write the view data of respective channel through the mode of aforementioned traversal version of all kinds.
In sum; The embodiment of the invention is to the defective that exists in the prior art; A kind of color separation processing method and device of image file are provided; Can resolve image file according to the required color mode of front end color separation, be processed into multi-channel data to picture material, in each look version, only embed the view data of respective channel.Avoid view data repeated storage in the prior art thus, can obviously improve the disk space utilization factor and improve document analysis speed.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to accomplish through program; Described program can be stored in the computer-readable recording medium; Described storage medium is like ROM/RAM, magnetic disc, CD etc.
The above; Be merely the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, any technician who is familiar with the present technique field is in the technical scope that the present invention discloses; The variation that can expect easily or replacement all should be forgiven within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claims.