Embodiment
In order that those skilled in the art more fully understand the present invention program, below in conjunction with the embodiment of the present invention
Accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only
The embodiment of a part of the invention, rather than whole embodiments.Based on the embodiment in the present invention, ordinary skill people
The every other embodiment that member is obtained under the premise of creative work is not made, it should all belong to the model that the present invention protects
Enclose.
It should be noted that term " first " in description and claims of this specification and above-mentioned accompanying drawing, "
Two " etc. be for distinguishing similar object, without for describing specific order or precedence.It should be appreciated that so use
Data can exchange in the appropriate case, so as to embodiments of the invention described herein can with except illustrating herein or
Order beyond those of description is implemented.In addition, term " comprising " and " having " and their any deformation, it is intended that cover
Cover it is non-exclusive include, be not necessarily limited to for example, containing the process of series of steps or unit, method, system, product or equipment
Those steps or unit clearly listed, but may include not list clearly or for these processes, method, product
Or the intrinsic other steps of equipment or unit.
Fig. 1 is the flow chart of the edit methods of picture according to embodiments of the present invention, as shown in figure 1, this method is included such as
Lower step:
Step S102, after picture editor is started, obtain the configuration file of the picture editor of establishment.
Wherein, configuration file can be Properties files, and the Properties files are a kind of storage key-value pairs
File.
Step S104, picture editing parameter is configured according to configuration file.
Step S106, picture to be edited is read from the picture address of picture to be edited.
Step S108, obtain picture editor's mode of the picture to be edited indicated by picture editor's parameter.
Step S110, treat editing picture using picture editor's mode and carry out picture editor, the picture after being edited.
Using the embodiment of the present invention, picture editing parameter is configured according to configuration file, compiled according to the picture in configuration file
Collect picture editor's mode indicated by parameter and edlin is entered to picture, it is complicated in the prior art using simple parameter configuration replacement
Parameter be manually entered, can simply and quickly editing picture, and it is more only to use a configuration file to complete simultaneously
Kind edit operation.By the above embodiment of the present invention, to it is a collection of need the picture for carrying out identical edit operation to handle when,
Without input identical picture editor's parameter is repeated several times, only need to easily change I/O Address can complete to scheme this batch
The processing of piece, it can be completed with a collection of editor for needing to carry out the mass picture of identical edit operation using a configuration file.
By the embodiment of the present invention, solve the problems, such as that processing picture is cumbersome in the prior art, improve processing picture operation
Efficiency.
In above-described embodiment, the picture address and picture of picture to be edited can be inputted by the interface of picture editor's program
The address preserved after editor, what above-mentioned I/O Address preserved after picture address and picture editor including picture to be edited
Address.
Fig. 2 is a kind of flow chart of the edit methods of optional picture according to embodiments of the present invention.As shown in Fig. 2 should
Edit methods comprise the following steps:
Step S202, introduce jar file.
Wherein, jar file is Java ARchive files, i.e. Java archive file, is a kind of with platform-independent file
Form, can be by multiple one file of file synthesis.
Step S204, newly-built imgProcessing.properties files.
Wherein, imgProcessing.properties files are the configuration file in above-described embodiment.
Step S206, the key-value pair of newly-built pretreatment in imgProcessing.properties files.
Wherein, step S206 corresponds to the step S104 in above-described embodiment;The key-value pair of pretreatment is joined including picture editor
The picture address of number and picture to be edited.
Step S208, call imgProcessing () editing picture.
Step S210, return to the picture after editor.
Specifically, the form that need to only set picture to pre-process in newly-built imgProcessing.properties files
Key-value pair, call the imgProcessing () can complete to picture processing operation.
Embodiment shown in Fig. 2 provides a kind of simple, efficiently picture processing method, utilizes Api explanations and jar texts
Part carries out outer packaging, coordinates Imagemagick of the prior art to carry out edit operation, wherein, Api Application
Programming Interface, i.e. application program become interface, are some pre-defined functions;Imagemagick is one
Individual free establishment, editor, the software of synthesising picture.
By the above embodiment of the present invention, the setting to picture editor's parameter can be completed using configuration file, without hand
The complicated editing parameter of dynamic input, can simply, efficiently complete the editor to picture.
According to the above embodiment of the present invention, configuring picture editing parameter according to configuration file can include:According to default lattice
Formula inputs picture editor's parameter in configuration file, wherein, picture editor's parameter includes shear parameters and/or zooming parameter.
Wherein, preset format can be the certain order format provided according to Api picture editor's parameter, be arranged in word
Value (value i.e. in key-value pair) of the symbol string as a pair of key-value pairs in imgProcessing.properties files.With
Family oneself defines the key (key i.e. in key-value pair) that title forms this pair of key assignments plus the Api prefixes provided.
Specifically, shear parameters can include shearing key-value pair, and the key of shearing key-value pair prefix is:Model_SH_
It is self-defined;Zooming parameter can include scaling key-value pair, and the key of scaling key-value pair prefix is:Model_NA_ is self-defined.
The prefix for the key for shearing key-value pair and the key of scaling key-value pair can be passed through in the above embodiment of the present invention
Prefix determine picture editor's mode, if Model_SH_ is shearing manipulation, Model_NA_ is zoom operations.
In the above embodiment of the present invention, shear parameters form can be key-value pair:key:Valve, i.e.
Model_SH_ User Defineds:
x/<X_Axis>/y/<Y_Axis>/w/<Width>/h/<Height>/format/<Format>.Wherein, X_
Axis is X-axis, and Y_Axis is y-axis, and Width is width, Height is height, Format is form.
Zooming parameter form can also be key-value pair:key:Value, i.e.
Model_NA_ User Defineds:w/<Width>/h/<Height>/format/<Format>.Wherein, Width is
Width, Height are height, Format is form.
By the above embodiment of the present invention, inputting picture editor's parameter in configuration file according to preset format can prompt
All parameters needed for user's input editing picture, the problem of parameter is easily missed when being manually entered parameter is avoided, is improved
Input the accuracy of picture editor's parameter;By inputting shear parameters and/or zooming parameter, Ke Yi in same configuration file
A variety of operations (e.g., while carry out scaling and the shearing of picture) are carried out in once editing to picture, solve in the prior art one
A kind of secondary the problem of can only carrying out operation to picture, improve the efficiency of picture editor.
In the above embodiment of the present invention, picture editor's parameter is zooming parameter, wherein, configured according to preset format
Picture editor's parameter is inputted in file to be included:First key-value pair of zooming parameter is set in configuration file, wherein, first
Key-value pair for zooming parameter property parameters and property parameters value mapping, the first key-value pair includes:Zoom width, scaling are high
The key-value pair of the form of picture after spending and editing.
For example, certain pictures are carried out with 400 × 600px scaling, and exported with png forms.It is above-mentioned according to the present invention
Embodiment, defining key values is:Model_NA_style1, and configure key assignments in imgProcessing.properties files
It is right:Model_NA_style1:w/400/h/600/format/png.User only needs when carrying out the zoom operations to the picture
ImgProcessing (address of processed picture, Model_SH_style1, the address preserved after picture processing) is directly invoked,
It can be achieved to carry out picture 400 × 600px scaling and exported with png forms.It is also, identical carrying out this to plurality of pictures
Zoom operations when, without inputting zooming parameter again, directly invoke above-mentioned imgProcessing () i.e. can be achieved to multiple
Picture is carried out 400 × 600px scaling and exported with png forms.Picture processing therein can be that picture editor is handled.
The address preserved after picture processing in above-described embodiment can be:The result of processing is put into the A files of D disks
Under.
By the above embodiment of the present invention, only zooming parameter need to be pre-configured with using a configuration file, needed to figure
Piece carries out calling the configuration file when meeting the scaling of zooming parameter, you can realizes the scaling to picture;Needing to multiple figures
Piece carries out calling the configuration file during identical zoom operations, without inputting zooming parameter again, only with need to changing input and output
Location can complete the scaling to plurality of pictures.
In the above embodiment of the present invention, picture editor's parameter is shear parameters, wherein, configured according to preset format
Picture editor's parameter is inputted in file to be included:Second key-value pair of shear parameters is set in configuration file, wherein, second
Key-value pair for shear parameters property parameters and property parameters value mapping, the second key-value pair can include:Shearing coordinate, cut
Cut the key-value pair of the form of the picture after width, shear height and editor.
Described above, x/<X_Axis>/y/<Y_Axis>/w/<Width>/h/<Height>/format/<Format>,
X, y, w, h and format are key, and X_Axis is the value of X-axis, and Y_Axis is the value of y-axis, and Width is the value of width, Height
It is form for the value of height, Format.
For example, certain pictures is sheared, wherein, shear parameters are as follows:Starting point is X-axis 20px, Y-axis 20px,
A width of 200px of frame is intercepted, intercepts a height of 100px of frame, the form of output is jpg forms.
According to the above embodiment of the present invention, defining key values is:Model_SH_style1, and
Key-value pair is configured in imgProcessing.prop-erties files:Model_SH_style1:x/20/y/20/w/200/h/
100/format/jpg.It is (processed need to only to directly invoke imgProcessing when carrying out shearing manipulation to the picture by user
The address of picture, Model_SH_style1, the address preserved after picture processing), you can realize and above-mentioned shearing is carried out to the picture
Operate and exported with jpg forms.Also, when carrying out the identical shearing manipulation to plurality of pictures, without inputting shearing again
Parameter, directly invoke above-mentioned imgProcessing () and can be achieved to carry out plurality of pictures identical shearing manipulation and with jpg
Form exports.
By the above embodiment of the present invention, only shear parameters need to be pre-configured with using a configuration file, needed to figure
Piece carries out calling the configuration file when meeting the shearing of shear parameters, you can realizes the shearing to picture;Needing to multiple figures
Piece carries out calling the configuration file during identical shearing manipulation, without inputting shear parameters again, only with need to changing input and output
Location can complete the shearing to plurality of pictures.
In the above embodiment of the present invention, the picture editor side of the picture to be edited indicated by picture editor's parameter is obtained
Formula can include:Decompose picture editor's parameter in configuration file;If it is shear parameters to decompose obtained picture editor's parameter,
The picture editor's mode for determining picture to be edited is shearing;If it is zooming parameter to decompose obtained picture editor's parameter, it is determined that
Picture editor's mode of picture to be edited is scaling;If picture editor's parameter that decomposition obtains is zooming parameter and shear parameters,
The picture editor's mode for then determining picture to be edited is scaling and scaling.
Specifically, in the above embodiment of the present invention, default picture editor's mode editor can be used to scheme by key
Piece.In the case where decomposing obtained picture editor's parameter and being shear parameters, it is determined that picture editor's mode of picture to be edited
, can be to the predetermined shearing manipulation of picture using the key of shearing key-value pair for shearing;Compiled in the picture that decomposition obtains
In the case of parameter is collected as zooming parameter, it is determined that picture editor's mode of picture to be edited is scaling, uses scaling key-value pair
Key can be to the predetermined zoom operations of picture;Obtained picture editor's parameter is being decomposed as zooming parameter and is being cut
In the case of cutting parameter, it is determined that picture editor's mode of picture to be edited is scaling and scaling, while uses shearing key-value pair
Key and the key of scaling key-value pair can complete shearing set in advance and zoom operations to picture.
It is it should be further stated that complete to picture using the key of shearing key-value pair and the key of scaling key-value pair at the same time
In the case of shearing and zoom operations, pipe can be used to realize the key's of the shearing key-value pair and key of scaling key-value pair
Use simultaneously.
Wherein, pipe is |, it is the multiple key of link that it, which is acted on, and successional processing is carried out to a pictures.
Fig. 3 is the flow chart of the edit methods of the optional picture of another kind according to embodiments of the present invention.With reference to Fig. 3
The above embodiment of the present invention is discussed in detail, as shown in figure 3, the edit methods comprise the following steps:
Step S302, call imgProcessing ().
Step S304, read picture editor's parameter in imgProcessing.properties files.
Step S306, the picture editor's parameter read is decomposed, picture editor's parameter after being decomposed.
Step S308, according to picture editor's parameter after decomposition, obtain different picture editor's modes.
Step S310, call Imagemagick instruments.
Specifically, Imagemagick instruments are called according to above-mentioned picture editor's mode editing picture.
Step S312, return to the picture after editor.
For example, zoomed in and out again after being sheared to certain pictures, wherein, shear parameters are:Starting point X-axis 20px, Y
Axle 20px, a width of 200px of frame is intercepted, intercept a height of 100px, the output format jpg of frame.Zooming parameter is:Picture is entered
400 × 600px of row scaling is simultaneously exported with png forms.
According to the above embodiment of the present invention, user, which can directly adjust, preserves imgProcessing inside the jar provided
(address of processed picture, Model_SH_style1 | Model_NA_style1, the address preserved after picture processing), you can
It is above-mentioned to picture progress first to shear the operation scaled afterwards.
If user wants first to zoom in and out certain pictures to shear again, only need to be by imgProcessing ()
Model_SH_style1 | Model_NA_style1 replaces with Model_NA_style1 | and Model_SH_style1, calling should
ImgProcessing () can carry out first scaling the operation sheared afterwards to picture.
By the above embodiment of the present invention, only need to simply, efficiently be divided by a configuration file can according to basis
Picture editor's parameter after solution enters edlin to picture, when needing to doing same treatment with batch of plurality of pictures, as long as repairing
Change the I/O Address in the configuration file, input identical picture editor's parameter without being repeated several times, improve defeated
Enter the accuracy of picture editor's parameter.
According to the above embodiment of the present invention, the configuration file of the picture editor of establishment can include:Picture editor's parameter
The default value of property parameters and property parameters.
Specifically, when the property parameters for detecting picture editor's parameter are default value, prompt message is issued the user with, is carried
Show that with whether the default value is changed, after user chooses whether to change the default value, figure is carried out according to the instruction of user by user
Piece editor.If user select change the default value, display modification property parameters dialog box, and change the default value it
Afterwards, according to amended property parameters editing picture;If user's selection is not changed, the default value editing picture is used.
By the above embodiment of the present invention, sent out when the property parameters for detecting picture editor's parameter are default value to user
Go out prompting, user can be prompted when user forgets to input some parameters, avoid and parameter is easily missed when being manually entered parameter
The problem of, the accuracy for inputting picture editor's parameter is improved, improves the editorial efficiency of picture.
It should be noted that can be in such as one group of computer executable instructions the flow of accompanying drawing illustrates the step of
Performed in computer system, although also, show logical order in flow charts, in some cases, can be with not
The order being same as herein performs shown or described step.
Fig. 4 is the schematic diagram of the editing device of picture according to embodiments of the present invention, as shown in figure 4, the editing device can
With including:First acquisition module 10, configuration module 30, read module 50, the second acquisition module 70 and editor module 90.
Wherein, the first acquisition module 10 is used for after picture editor is started, and obtains the configuration text of the picture editor of establishment
Part;Configuration module 30 is used for the picture address that picture editing parameter and picture to be edited are configured according to configuration file;Read module
50 are used to read picture to be edited from the picture address of picture to be edited;Second acquisition module 70 is used to obtain picture editor's parameter
Picture editor's mode of indicated picture to be edited;Editor module 90 enters for treating editing picture using picture editor's mode
Row picture editor, the picture after being edited.
Using the embodiment of the present invention, the picture address of picture editing parameter and picture to be edited is configured by configuration file,
Editor module enters edlin according to picture editor's mode indicated by picture editor's parameter in configuration file to picture, uses letter
Single parameter configuration replaces parameter complicated to be in the prior art manually entered, can simply and quickly editing picture, and only needing
A variety of edit operations can be completed simultaneously using a configuration file.By the above embodiment of the present invention, to it is a collection of need into
When the picture of the identical edit operation of row is handled, identical picture editor's parameter is inputted without being repeated several times, is only needed easily
Modification I/O Address can complete processing to this batch of picture, using a configuration file can complete with it is a collection of need into
The editor of the mass picture of the identical edit operation of row.By the embodiment of the present invention, solve and handle picture operation in the prior art
The problem of cumbersome, improve the efficiency of processing picture operation.
Wherein, above-mentioned I/O Address is the picture address of picture to be edited, and the picture address includes being schemed by editor
The address preserved after the address of piece and picture editor.
According to the above embodiment of the present invention, configuration module can include:Input module, for being configured according to preset format
Picture editor's parameter, and the picture address of input picture to be edited are inputted in file, wherein, picture editor's parameter includes shearing and joined
Number and/or zooming parameter.
Wherein, preset format can be the certain order format provided according to Api picture editor's parameter, be arranged in word
Value (value i.e. in key-value pair) of the symbol string as a pair of key-value pairs in imgProcessing.properties files.With
Family oneself defines the key (key i.e. in key-value pair) that title forms this pair of key assignments plus the Api prefixes provided.
Specifically, shear parameters can include shearing key-value pair, and the key of shearing key-value pair prefix is:Model_SH_
It is self-defined;Zooming parameter can include scaling key-value pair, and the key of scaling key-value pair prefix is:Model_NA_ is self-defined.
The prefix for the key for shearing key-value pair and the key of scaling key-value pair can be passed through in the above embodiment of the present invention
Prefix determine picture editor's mode, if Model_SH_ is shearing manipulation, Model_NA_ is zoom operations.
In the above embodiment of the present invention, shear parameters form can be key-value pair:key:Valve, i.e.
Model_SH_ User Defineds:
x/<X_Axis>/y/<Y_Axis>/w/<Width>/h/<Height>/format/<Format>.Wherein, X_
Axis is X-axis, and Y_Axis is y-axis, and Width is width, Height is height, Format is form.
Zooming parameter form can also be key-value pair:key:Value, i.e.
Model_NA_ User Defineds:w/<Width>/h/<Height>/format/<Format>.Wherein, Width is
Width, Height are height, Format is form.
By the above embodiment of the present invention, picture editor's parameter and to be edited is inputted in configuration file according to preset format
The picture address of picture can prompt all parameters needed for user's input editing picture, and it is easy when being manually entered parameter to avoid
The problem of missing parameter, improve the accuracy of input picture editor's parameter;By inputting shearing ginseng in same configuration file
Number and/or zooming parameter, a variety of operations can be carried out to picture in once editing and (e.g., while carry out the scaling of picture and cut
Cut), solve the problems, such as once carry out picture a kind of operation in the prior art, improve the efficiency of picture editor.
In the above embodiment of the present invention, picture editor's parameter is zooming parameter, wherein, configuration module can include:
First setup module, for setting the first key-value pair of zooming parameter in configuration file, wherein, the first key-value pair is joined for scaling
The mapping of several property parameters and values of property parameters, the first key-value pair include:After zoom width, scaling height and editor
The key-value pair of the form of picture.
By the above embodiment of the present invention, only zooming parameter need to be pre-configured with using a configuration file, needed to figure
Piece carries out calling the configuration file when meeting the scaling of zooming parameter, you can realizes the scaling to picture;Needing to multiple figures
Piece carries out calling the configuration file during identical zoom operations, without inputting zooming parameter again, only with need to changing input and output
Location can complete the scaling to plurality of pictures.
According to the above embodiment of the present invention, picture editor's parameter is shear parameters, wherein, configuration module can include:The
Two setup modules, for setting the second key-value pair of shear parameters in configuration file, wherein, the second key-value pair is shear parameters
Property parameters and property parameters value mapping, the second key-value pair includes:Shear coordinate, shearing width, shear height and
The key-value pair of the form of picture after editor.
Described above, x/<X_Axis>/y/<Y_Axis>/w/<Width>/h/<Height>/format/<Format>,
X, y, w, h and format are key, and X_Axis is the value of X-axis, and Y_Axis is the value of y-axis, and Width is the value of width, Height
It is form for the value of height, Format.
According to the above embodiment of the present invention, defining key values is:Model_SH_style1, and
Key-value pair is configured in imgProcessing.prop-erties files:Model_SH_style1:x/20/y/20/w/200/h/
100/format/jpg.It is (processed need to only to directly invoke imgProcessing when carrying out shearing manipulation to the picture by user
The address of picture, Model_SH_style1, the address preserved after picture processing), you can realize and above-mentioned shearing is carried out to the picture
Operate and exported with jpg forms.Also, when carrying out the identical shearing manipulation to plurality of pictures, without inputting shearing again
Parameter, directly invoke above-mentioned imgProcessing () and can be achieved to carry out plurality of pictures identical shearing manipulation and with jpg
Form exports.
By the above embodiment of the present invention, only shear parameters need to be pre-configured with using a configuration file, needed to figure
Piece carries out calling the configuration file when meeting the shearing of shear parameters, you can realizes the shearing to picture;Needing to multiple figures
Piece carries out calling the configuration file during identical shearing manipulation, without inputting shear parameters again, only with need to changing input and output
Location can complete the shearing to plurality of pictures.
According to the above embodiment of the present invention, the second acquisition module can include:Decomposing module, for decomposing in configuration file
Picture editor's parameter;First determining module, in the case that picture editor's parameter for being obtained in decomposition is shear parameters, really
Picture editor's mode of fixed picture to be edited is shearing;Second determining module, picture editor's parameter for being obtained in decomposition are
In the case of zooming parameter, the picture editor's mode for determining picture to be edited is scaling;3rd determining module, for decomposing
In the case that the picture editor's parameter arrived is zooming parameter and shear parameters, the picture editor's mode for determining picture to be edited is contracting
Put and scale.
Specifically, in the above embodiment of the present invention, default picture editor's mode editor can be used to scheme by key
Piece.In the case where decomposing obtained picture editor's parameter and being shear parameters, it is determined that picture editor's mode of picture to be edited
, can be to the predetermined shearing manipulation of picture using the key of shearing key-value pair for shearing;Compiled in the picture that decomposition obtains
In the case of parameter is collected as zooming parameter, it is determined that picture editor's mode of picture to be edited is scaling, uses scaling key-value pair
Key can be to the predetermined zoom operations of picture;Obtained picture editor's parameter is being decomposed as zooming parameter and is being cut
In the case of cutting parameter, it is determined that picture editor's mode of picture to be edited is scaling and scaling, while uses shearing key-value pair
Key and the key of scaling key-value pair can complete shearing set in advance and zoom operations to picture.
It is it should be further stated that complete to picture using the key of shearing key-value pair and the key of scaling key-value pair at the same time
In the case of shearing and zoom operations, pipe can be used to realize the key's of the shearing key-value pair and key of scaling key-value pair
Use simultaneously.
Wherein, pipe is |, it is the multiple key of link that it, which is acted on, and successional processing is carried out to a pictures.
By the above embodiment of the present invention, only need to simply, efficiently be divided by a configuration file can according to basis
Picture editor's parameter after solution enters edlin to picture, when needing to doing same treatment with batch of plurality of pictures, as long as repairing
Change the I/O Address in the configuration file, input identical picture editor's parameter without being repeated several times, improve defeated
Enter the accuracy of picture editor's parameter.
Modules provided in the present embodiment are identical with the application method that the corresponding step of embodiment of the method is provided, should
Can also be identical with scene.It is noted, of course, that the scheme that above-mentioned module is related to can be not limited in above-described embodiment one
Content and scene, and above-mentioned module may operate in terminal or mobile terminal, can pass through software or hardware is realized.
As can be seen from the above description, the present invention realizes following technique effect:
Using the embodiment of the present invention, the picture address of picture editing parameter and picture to be edited is configured by configuration file,
Edlin is entered to picture according to picture editor's mode indicated by picture editor's parameter in configuration file, uses simple parameter
Configuration replaces parameter complicated to be in the prior art manually entered, can simply and quickly editing picture, and need to only use one
Configuration file can complete a variety of edit operations simultaneously.By the above embodiment of the present invention, need to carry out identical volume to a collection of
The picture of volume operation inputs identical picture editor's parameter without being repeated several times, only need to easily change input when being handled
OPADD can complete the processing to this batch of picture, can complete to need to carry out identical volume with a collection of using a configuration file
Collect the editor of the mass picture of operation.By the embodiment of the present invention, solve processing in the prior art picture is cumbersome and ask
Topic, improve the efficiency of processing picture operation.
Obviously, those skilled in the art should be understood that above-mentioned each module of the invention or each step can be with general
Computing device realize that they can be concentrated on single computing device, or be distributed in multiple computing devices and formed
Network on, alternatively, they can be realized with the program code that computing device can perform, it is thus possible to they are stored
Performed in the storage device by computing device, either they are fabricated to respectively each integrated circuit modules or by they
In multiple modules or step be fabricated to single integrated circuit module to realize.So, the present invention is not restricted to any specific
Hardware and software combines.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should be included in the scope of the protection.