The content of the invention
The embodiment of the present invention provides a kind of GIF image edit methods and device, to solve GIF images volume in the prior art
Caused by volume the technical issues of poor quality images.
A kind of GIF image edit methods, the described method includes:
Using zoom factor, processing is zoomed in and out to original image file, image file after being scaled;
Interception scope is determined from image file after the scaling, and scope and the zoom factor are intercepted according to described,
Determine relative position of the interception scope in the original image file;
According to the size of the original image file, the relative position in the original image file is saved as to image after editing
File.
Preferably, the mode for determining the zoom factor is:
It is instructed in response to scaling, determines to zoom in and out the original image file zoom factor of processing.
Preferably, determine that the mode for intercepting scope is:
It is instructed in response to interception, determines the position of interception scope image file after the scaling.
Preferably, determine that the mode for intercepting scope is:
According to video ratio, position of the interception scope after the scaling in image file is determined.
Preferably, according to the interception scope and the zoom factor, determine the interception scope in original image text
Relative position in part, including:
Obtain the position coordinates of four endpoints of the interception scope;
Using the position coordinates difference of four endpoints divided by the zoom factor, four endpoints are obtained described
Relative coordinate in original image file;
The relative position is determined according to the relative coordinate.
A kind of GIF image editing apparatus, described device include:
Processing unit is scaled, for utilizing zoom factor, processing is zoomed in and out to original image file, image after being scaled
File;
Scope determination unit is intercepted, for determining interception scope from image file after the scaling;
Relative position determination unit, for according to the interception scope and the zoom factor, determining the interception scope
Relative position in the original image file;
For the size according to the original image file, the relative position in the original image file is protected for storage unit
Save as image file after editing.
Preferably, the scaling processing unit, specifically in response to scaling instruct, determine to the original image file into
The zoom factor of row scaling processing.
Preferably, the interception scope determination unit specifically for being instructed in response to interception, determines that the interception scope exists
The position of image file after the scaling.
Preferably, the interception scope determination unit, specifically for according to video ratio, determining the interception scope in institute
State the position in image file after scaling.
Preferably, the relative position determination unit includes:
Position coordinates obtaining unit, for obtaining the position coordinates of four endpoints of the interception scope;
Relative coordinate obtaining unit, for utilizing the position coordinates of four endpoints difference divided by the zoom factor,
Obtain relative coordinate of four endpoints in the original image file;
Relative position determination subelement, for determining the relative position according to the relative coordinate.
Compared with prior art, GIF image edit methods and device provided in an embodiment of the present invention, utilize zoom factor pair
Original image file zooms in and out processing, image file after being scaled, and determines interception scope in image file after scaling,
Zoom factor and interception scope can be utilized, relative position of the interception scope in original image file is calculated, and then utilizes the phase
To the edited image file of the view generation of position.The edited figure of the view generation for intercepting scope is utilized compared with the prior art
As file, the present invention program, so that it may the pixel for carrying image information be avoided to lose to a certain extent, retain this part as far as possible
Pixel, so that it may make it possible that picture quality remains unchanged after editor.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other without making creative work
Embodiment belongs to the scope of protection of the invention.
With reference to figure 1, a kind of flow chart of GIF image edit methods of the embodiment of the present invention is shown, can include following step
Suddenly:
S101 using zoom factor, zooms in and out processing, image file after being scaled to original image file.
It should be noted that the present embodiments relate to editing and processing be mainly reflected in the scaling processing procedure of image.
First, can be completed to handle the scaling of original image file according to zoom factor, image file after being scaled.Using enhanced processing as
Example, the step can be presented as, according to zoom factor, amplify the pixel in original image file.
As a kind of example, zoom factor can be specifically determined in the following manner:
Mode one can receive externally input scaling instruction, zoom factor is extracted in being instructed from scaling, and then according to scaling
The factor completes scaling processing.
Mode two, image file after can also first being scaled according to user's operation, after recycling original image file and scaling
Image file calculates zoom factor.For example, user is completed by this operational motion of roll mouse to original image file
Scaling processing, image file after scale, then compare original image file and scaling after image file size, acquisition scale because
Son.
S102 determines interception scope from image file after the scaling.
Image file after being scaled by scaling processing can therefrom determine interception scope, i.e. the image text after scaling
Part centre circle makes user and wishes position where the view retained, alternatively, it is also understood that being to determine after compiled processing most
Any need that partial view is presented eventually.
As a kind of example, interception scope can be specifically determined in the following manner:
Mode one, can receive it is externally input interception instruction, according to interception instruction instruction, after scaling in image file
Determine interception scope.For example, the position coordinates of four endpoints of interception scope can be included in interception instruction.
Mode two can determine interception scope according to video ratio after scaling in image file.Wherein, video ratio
The video pictures length of video player broadcasting and wide ratio are can be understood as, e.g., video ratio can be 4:3、16:9 etc..
Scope is intercepted according to video ratio-dependent, can effectively avoid in image file and black surround phenomenon occur, as far as possible image file is made only to wrap
Include the pixel for carrying image information.
Mode three can combine interception instruction and video ratio, comprehensive to determine interception scope, specifically can refer to above two
Mode realizes that details are not described herein again.
S103 according to the interception scope and the zoom factor, determines the interception scope in the original image file
In relative position.
Relative position in the original image file according to the size of the original image file, is saved as editor by S104
Image file afterwards.
After obtaining zoom factor and interception scope, you can clearly go out the view for needing to present in original image file according to the two
Relative position, when carrying out preserving operation, directly to utilize the view of the relative position in original image file, generation volume
Image file after volume.Compared with the prior art preservation operation, such scheme, so that it may to a certain extent are carried out for image after scaling
The pixel for carrying image information is avoided to lose, retains this partial pixel point as far as possible, so that it may which picture quality is kept not after making editor
It is turned into possibility.
As a kind of example, the relative position can be specifically determined in the following manner, it may include:First, with reference to scaling
Coordinate system used in image file afterwards obtains the position coordinates of four endpoints of the interception scope;Secondly, described four ends are utilized
The position coordinates difference of point divided by the zoom factor obtain opposite seat of four endpoints in the original image file
Mark;Finally, according to the four of acquisition relative coordinates, the relative position is determined in source image file.
It should be noted that the editing process of the embodiment of the present invention is illustrated only by taking enhanced processing as an example above,
In view of in scaling processing procedure, the number for carrying the pixel of image information after scaling in image file does not change,
And processing or diminution processing are whether amplified to pixel, for original image file, it can generate image matter
The problem of quantitative change is poor, therefore, the embodiment of the present invention are also suitable for image down processing procedure, and specific implementation process can refer to
Introduction made above, details are not described herein again.
In addition, it is necessary to explanation, if in GIF recording process, at least two are obtained from interception conversion in video is played
GIF image files then before picture editting is carried out, may also be responsive to externally input instruction, from least two GIF image files
One GIF image file of middle selection is as the original image file in the embodiment of the present invention.
With method as described above correspondingly, referring to Fig. 2, the embodiment of the present invention additionally provides a kind of GIF picture edittings dress
It puts, can specifically include:
Processing unit 201 is scaled, for utilizing zoom factor, processing is zoomed in and out to original image file, after being scaled
Image file;
Scope determination unit 202 is intercepted, for determining interception scope from image file after the scaling;
Relative position determination unit 203, for according to the interception scope and the zoom factor, determining the interception model
The relative position being trapped among in the original image file;
Storage unit 204, for the size according to the original image file, by the relative position in the original image file
Save as image file after editing.
Optionally, the scaling processing unit, specifically in response to scaling instruct, determine to the original image file into
The zoom factor of row scaling processing.
Optionally, the interception scope determination unit specifically for being instructed in response to interception, determines that the interception scope exists
The position of image file after the scaling.
Optionally, the interception scope determination unit, specifically for according to video ratio, determining the interception scope in institute
State the position in image file after scaling.
Optionally, the relative position determination unit includes:
Position coordinates obtaining unit, for obtaining the position coordinates of four endpoints of the interception scope;
Relative coordinate obtaining unit, for utilizing the position coordinates of four endpoints difference divided by the zoom factor,
Obtain relative coordinate of four endpoints in the original image file;
Relative position determination subelement, for determining the relative position according to the relative coordinate.
It should be noted that each embodiment in this specification is described by the way of progressive, each embodiment weight
Point explanation is all difference from other examples, and just to refer each other for identical similar part between each embodiment.
For device class embodiment, since it is basicly similar to embodiment of the method, so description is fairly simple, related part ginseng
See the part explanation of embodiment of the method.
Finally, it is to be noted that, herein, term " comprising ", "comprising" or its any other variant are intended to
Cover non-exclusive inclusion, so that process, method, article or equipment including a series of elements not only include those
Element, but also including other elements that are not explicitly listed or further include as this process, method, article or set
Standby intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
Also there are other identical elements in the process, method, article or apparatus that includes the element.
A kind of GIF image edit methods provided by the present invention are described in detail above, tool used herein
Body example is set forth the principle of the present invention and embodiment, and the explanation of above example is only intended to help to understand this hair
Bright method and its core concept;Meanwhile for those of ordinary skill in the art, thought according to the invention, specific real
There will be changes in mode and application range are applied, in conclusion this specification content should not be construed as the limit to the present invention
System.