CN107590848A - Picture generation method and device, electronic equipment and storage medium - Google Patents

Picture generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN107590848A
CN107590848A CN201710914775.3A CN201710914775A CN107590848A CN 107590848 A CN107590848 A CN 107590848A CN 201710914775 A CN201710914775 A CN 201710914775A CN 107590848 A CN107590848 A CN 107590848A
Authority
CN
China
Prior art keywords
picture
background layer
content element
adjustment
original picture
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
CN201710914775.3A
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 Internet Security Software Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software 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 Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201710914775.3A priority Critical patent/CN107590848A/en
Publication of CN107590848A publication Critical patent/CN107590848A/en
Pending legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a picture generation method, a picture generation device, electronic equipment and a storage medium, relates to the technical field of computers, and can effectively solve the problem that image content in a picture is easy to deform or lose when unequal proportion adjustment is carried out on the width and the height of the picture. The method comprises the following steps: receiving the import of an original picture; adjusting the background layer of the original picture and the content elements on the background layer according to a preset target outline size and a composition position between the content elements in the original picture and the background layer to obtain an adjusted picture; the overall dimension of the background layer of the adjusted picture is the same as the overall dimension of the target, and the aspect ratio in the overall dimension of the target is different from that of the original picture; in the adjusted picture, the aspect ratio of the content element is the same as the aspect ratio of the content element in the original picture, and the boundary of the content element is located within the outline boundary of the adjusted picture.

Description

A kind of Picture Generation Method, device, electronic equipment and storage medium
Technical field
The present invention relates to field of computer technology, more particularly to a kind of Picture Generation Method, device, electronic equipment and storage Medium.
Background technology
Various applications show and video text editing in, in order to adapt to space of a whole page requirement usually wide, high size of the needs to picture Carry out the adjustment of inequality proportion.
At present, the method for inequality proportion adjustment being carried out to wide, the high size of picture, mainly carry out simply stretching, press Contracting is cut, the phenomenon that the picture material that this picture processing mode is often led in picture is deformed or lacked, picture Treatment effect is poor.
The content of the invention
In view of this, the embodiment of the present invention provides a kind of Picture Generation Method, device, electronic equipment and storage medium, figure The treatment effect of piece is preferable, to solve when entering picture the high inequality proportion of line width and adjusting easily to cause in picture in the prior art Picture material deformation or missing the problem of.
In a first aspect, the embodiment of the present invention provides a kind of Picture Generation Method, including:The importing of original picture is received, it is described Original picture includes background layer and the content element on the background layer;According to default target shape size, the artwork The patterning positions between content element and background layer in piece, background layer to the original picture and on the background layer Content element, which is adjusted, is adjusted picture;Wherein, the background layer appearance and size of the adjustment picture and the target shape Size is identical, and the ratio of width to height in the target shape size is different from the ratio of width to height of the original picture;In the adjustment picture, The ratio of width to height of the content element is identical with the ratio of width to height of the content element in the original picture, and the border of the content element In the profile boundaries of the adjustment picture;The adjustment picture is exported to obtain the target with the target shape size Picture.
With reference in a first aspect, in the first embodiment of first aspect, it is described according to default target shape size, The patterning positions between content element and background layer in the original picture, background layer to the original picture and positioned at the back of the body Content element in background layer, which is adjusted, to be adjusted picture and includes:The original picture is adjusted to obtain the first adjustment figure Piece, the background layer appearance and size of the first adjustment picture are identical with the target shape size;Determine the first adjustment figure In piece, whether the border of the content element exceeds the profile boundaries of the background layer of the described first adjustment picture;In the content In the case that the border of element exceeds the profile boundaries of the background layer of the described first adjustment picture, the content element is protected Shield property adjusts to obtain the adjustment picture.
With reference to the first embodiment of first aspect, in second of embodiment of first aspect, the protectiveness Adjustment includes displacement and/or wide high scaled down.
It is described to described in the third embodiment of first aspect with reference to the first embodiment of first aspect Original picture, which is adjusted to obtain the first adjustment picture, to be included:In the width for being wider than the original picture of the target shape size, And/or the target shape size is tall and big in the case of the height of the original picture, the background layer of the original picture is carried out Stretch accordingly, so that the appearance and size of the background layer after stretching and the target shape are equal sized;According to described The wide and/or high draw ratio of background layer, the content element is entered line width height etc. it is scaling with obtain it is described first adjust Whole picture.
It is described to described in the 4th kind of embodiment of first aspect with reference to the first embodiment of first aspect Original picture, which is adjusted to obtain the first adjustment picture, to be included:It is less than the width of the original picture in the width of the target shape size, And/or in the case that the height of the target shape size is less than the height of the original picture, the background layer of the original picture is carried out Compress accordingly, so that the appearance and size of the background layer after compression and the target shape are equal sized;According to described The wide and/or high compression multiple of background layer, the scale smallers such as line width height are entered to the content element and are adjusted with obtaining described first Whole picture.
It is described to described in the 5th kind of embodiment of first aspect with reference to the first embodiment of first aspect Original picture, which is adjusted to obtain the first adjustment picture, to be included:It is less than the width of the original picture in the width of the target shape size, And/or in the case that the height of the target shape size is less than the height of the original picture, the background layer of the original picture is carried out Cut, so that the appearance and size of the background layer after cutting and the target shape are equal sized.
With reference to any of the first to five kind of embodiment of first aspect or first aspect, the 6th of first aspect the It is described to export to obtain the Target Photo bag with the target shape size by the described second adjustment picture in kind embodiment Include:The described second adjustment picture is exported to obtain having the target shape size by way of depositing screenshotss, snapshot or separately Target Photo.
With reference to any of the first to five kind of embodiment of first aspect or first aspect, the 7th of first aspect the In kind embodiment, after the importing of the reception original picture, in the background layer to the original picture and positioned at the background Content element on layer is adjusted before being adjusted picture, and methods described also includes:For the content element, element is set Protecting frame.
With reference to any of the first to five kind of embodiment of first aspect or first aspect, the 8th of first aspect the In kind of embodiment, it is described the adjustment picture is exported to obtain the Target Photo with the target shape size after, Methods described also includes:The Target Photo is externally sent according to picture download request.
Second aspect, embodiments of the invention provide a kind of photograph creation device, including:Receiving unit, for receiving original The importing of picture, the original picture include background layer and the content element on the background layer;Adjustment unit, for basis Patterning positions between default target shape size, content element and background layer in the original picture, to the original picture Background layer and the content element on the background layer be adjusted and be adjusted picture;Wherein, the adjustment picture Background layer appearance and size is identical with the target shape size, the ratio of width to height in the target shape size and the original picture The ratio of width to height is different;In the adjustment picture, the ratio of width to height of the content element and the width of the content element in the original picture Height is than identical, and the border of the content element is in the profile boundaries of the adjustment picture;Output unit, for by described in Adjustment picture exports to obtain the Target Photo with the target shape size.
With reference to second aspect, in the first embodiment of second aspect, the adjustment unit includes:First adjustment Unit, for being adjusted to obtain the first adjustment picture, the background layer profile chi of the first adjustment picture to the original picture It is very little identical with the target shape size;Determination subelement, for determining in the first adjustment picture, the content element Whether border exceeds the profile boundaries of the background layer of the described first adjustment picture;Second adjustment subelement, in the content In the case that the border of element exceeds the profile boundaries of the background layer of the described first adjustment picture, the content element is protected Shield property adjusts to obtain the adjustment picture.
With reference to the first embodiment of second aspect, in second of embodiment of second aspect, the protectiveness Adjustment includes displacement and/or wide high scaled down.
With reference to the first embodiment of second aspect, in the third embodiment of second aspect, described first adjusts Whole subelement includes:Background stretching module, for the width for being wider than the original picture in the target shape size, and/or The target shape size it is tall and big in the case of the height of the original picture, the background layer of the original picture is carried out corresponding Stretch, so that the appearance and size of the background layer after stretching and the target shape are equal sized;Element amplification module, is used for According to the wide and/or high draw ratio to the background layer, it is scaling to obtain that line width height etc. is entered to the content element The first adjustment picture.
With reference to the first embodiment of second aspect, in the 4th kind of embodiment of second aspect, described first adjusts Whole subelement includes:Background compression module, for being less than the width of the original picture in the width of the target shape size, and/or In the case that the height of the target shape size is less than the height of the original picture, the background layer of the original picture is carried out accordingly Compress, so that the appearance and size of the background layer after compression and the target shape are equal sized;Element reduces module, is used for According to the wide and/or high compression multiple to the background layer, the scale smallers such as line width height are entered to the content element to obtain The first adjustment picture.
With reference to the first embodiment of second aspect, in the 5th kind of embodiment of second aspect, described first adjusts Whole subelement includes:Background cuts module, for being less than the width of the original picture in the width of the target shape size, and/or In the case that the height of the target shape size is less than the height of the original picture, the background layer of the original picture is cut, So that the appearance and size of the background layer after cutting and the target shape are equal sized.
With reference to any of the first to five kind of embodiment of second aspect or second aspect, the 6th of second aspect the In kind embodiment, the output unit, specifically for exporting the adjustment picture by way of depositing screenshotss, snapshot or separately To obtain that there is the Target Photo of the target shape size.
With reference to any of the first to five kind of embodiment of second aspect or second aspect, the 7th of second aspect the In kind of embodiment, described device also includes setting unit, for after the importing of reception original picture, to the original picture Background layer and the content element on the background layer are adjusted before being adjusted picture, are set for the content element Element protecting frame.
With reference to any of the first to five kind of embodiment of second aspect or second aspect, the 8th of second aspect the In kind embodiment, described device also includes transmitting element, for exporting to obtain with described by the adjustment picture described After the Target Photo of target shape size, the Target Photo is externally sent according to picture download request.
The third aspect, embodiments of the invention also provide a kind of electronic equipment, and the electronic equipment includes:Housing, processing Device, memory, circuit board and power circuit, wherein, circuit board is placed in the interior volume that housing surrounds, processor and memory Set on circuit boards;Power circuit, for each circuit or the device power supply for above-mentioned electronic equipment;Memory is used to store Executable program code;The executable program code that processor is stored by reading in memory is run and executable program generation Program corresponding to code, the Picture Generation Method provided for performing any embodiment of the present invention.
Fourth aspect, embodiments of the invention also provide a kind of computer-readable recording medium, described computer-readable to deposit Storage media is stored with one or more program, one or more of programs can by one or more computing device, To realize the Picture Generation Method of any embodiment offer of the present invention.
5th aspect, embodiments of the invention also provide a kind of application program, and the application program is performed to realize this The Picture Generation Method that invention any embodiment provides.
Picture Generation Method, device, electronic equipment and the storage medium that embodiments of the invention provide, can be to picture Content element on background layer and background layer is adjusted respectively is adjusted picture, the background layer profile of the adjustment picture Size is identical with target shape size, in picture is adjusted, the ratio of width to height of the content element and the content in the original picture The ratio of width to height of element is identical, and the border of the content element is located in the profile boundaries of the adjustment picture, then according to tune Whole picture obtains Target Photo, so, in the case where the content element in ensureing picture is not distorted, can generate wide height The Target Photo more different than from original picture, efficiently solve easily causes figure when the width height to picture carries out inequality proportion adjustment The problem of picture material in piece is deformed or lacked, substantially increases picture quality.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is a kind of flow chart for the Picture Generation Method that embodiments of the invention provide;
Fig. 2 is a kind of schematic diagram being adjusted in embodiments of the invention to picture;
Fig. 3 is another schematic diagram being adjusted in embodiments of the invention to picture;
Fig. 4 is another schematic diagram being adjusted in embodiments of the invention to picture;
Fig. 5 is the structural representation of original picture and the new picture of generation in embodiments of the invention;
Fig. 6 is a kind of flow chart of the generation method of the picture shown in Fig. 5;
Fig. 7 is a kind of structural representation for the photograph creation device that embodiments of the invention provide;
Fig. 8 is a kind of structural representation for the electronic equipment that embodiments of the invention provide.
Embodiment
The embodiment of the present invention is described in detail below in conjunction with the accompanying drawings.
It will be appreciated that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.Base Embodiment in the present invention, those of ordinary skill in the art obtained under the premise of creative work is not made it is all its Its embodiment, belongs to the scope of protection of the invention.
In a first aspect, the embodiment of the present invention provides a kind of Picture Generation Method, the treatment effect of picture is preferable, can solve the problem that Easily cause what the picture material in picture was deformed or lacked when entering the high inequality proportion of line width to picture and adjusting in the prior art Problem.
It should be noted that Picture Generation Method provided in an embodiment of the present invention can be held under webpage WEB editing environments OK, can be applied to the various applications including web displaying show and video text editing in, embodiments of the invention are not done to this Limit.Powerful calculating and disposal ability based on server, Picture Generation Method provided in an embodiment of the present invention can be in client Extensive use in end, server architecture.The size of original picture and the Target Photo for needing to generate is sent to service by client Device, is adjusted to meet the Target Photo of size requirement by server by original picture, and client can download the target from server Picture.Optionally, for same original picture, multiple target size parameters disposably can be sent to server, you can Server end generates multiple various sizes of Target Photos.Certainly, with the enhancing of personal computer and terminal processing capacity, Picture Generation Method provided in an embodiment of the present invention can also be performed on the basis of unit, and embodiments of the invention are not limited this It is fixed.
Fig. 1 is a kind of flow chart for the Picture Generation Method that embodiments of the invention provide, as shown in figure 1, the present embodiment Picture Generation Method can include:
S11, receive the importing of original picture.
Wherein, the original picture can be that the relative position between any figure layer that can obtain separation and each figure layer is closed The picture of system, such as can be the picture file of psd forms, AI forms or TIF forms.The original picture includes original picture The information such as background layer and the content element on background layer.Optionally, content element can be various including being shown on picture Pictorial element and/or editor's information.Wherein, pictorial element is the element for belonging to original picture, and element in itself can not be by user again Editor, and edits various editor's information such as word, scribble etc. that information refers to add in original picture, edit information can by with Family is updated, and so as in the case where not changing pictorial element, easily change the information of personalization, makes whole picture Processing and application it is more flexible.
The original picture can imported into unit and be handled by unit, be uploaded to also into after client by client In server, the specific processing of picture can be carried out in server end.
S12, the composition position between content element and background layer in default target shape size, the original picture Put, the background layer to the original picture and the content element on the background layer are adjusted and are adjusted picture;It is described It is identical with the target shape size to adjust the background layer appearance and size of picture, the ratio of width to height and institute in the target shape size The ratio of width to height for stating original picture is different.It is described adjustment picture in, the ratio of width to height of the content element with it is interior in the original picture The ratio of width to height of appearance element is identical, and the border of the content element is in the profile boundaries of the adjustment picture.
S13, the adjustment picture is exported to obtain the Target Photo with the target shape size.
The Picture Generation Method that embodiments of the invention provide, can be to the content on the background layer and background layer of picture Element is adjusted respectively is adjusted picture, and the background layer appearance and size of the adjustment picture is identical with target shape size, In picture is adjusted, the ratio of width to height of the content element is identical and described with the ratio of width to height of the content element in the original picture Then the border of content element obtains Target Photo in the profile boundaries of the adjustment picture according to adjustment picture, so, In the case where the content element in ensureing picture is not distorted, the ratio of width to height target figure different from original picture can be generated Piece, efficiently solve and carry out easily causing the picture material in picture to deform or lack during inequality proportion adjustment high to the width of picture The problem of mistake, substantially increase picture quality.
Specifically, in step s 11, the original picture importeding into unit or server, the background of original picture is included Layer information and the content element information on background layer.Wherein, background layer can only be passed through without any image in background layer Width and height dimensions define the breadth size and profile of original picture.All picture materials can serve as on background layer in original picture Content element, each content element is separate.Optionally, the border of content element can be enclosed on outside the content element One rectangle frame, the border both can be acquiescence or set according to instruction.The ratio of width to height of each content element etc. In the ratio of width to height of corresponding rectangle frame.
The relation of original picture, background layer and content element can be schemed with the different of picture in the softwares such as analogy Photoshop Layer design.For example, there is a girl and a doggie to be run on meadow in one embodiment of the invention, in original picture, Then the appearance and size of background layer decides the appearance and size of picture in its entirety, if the size of background layer is 30*70, original picture Size i.e. 30*70, girl, doggie and meadow are respectively the content element on background layer.Certainly, in other realities of the present invention Apply in example, can also be using meadow as green background layer, using girl and doggie as two content elements in the background layer.
After receiving original picture, you can in step s 12 according in default target shape size, the original picture Hold the patterning positions between element and background layer, the background layer to original picture and the content element on the background layer are carried out Adjustment is adjusted picture, can specifically include:
Original picture is adjusted to obtain the first adjustment picture, the background layer appearance and size of the first adjustment picture and institute It is identical to state target shape size;
Determine in the first adjustment picture, whether the border of the content element is beyond described first back of the body for adjusting picture The profile boundaries of background layer;
It is right in the case where the border of the content element is beyond the profile boundaries of the background layer of the described first adjustment picture The content element carries out protectiveness and adjusts to obtain the adjustment picture.
Specifically, by original picture be adjusted to the first adjustment picture process be it is a kind of just successive step, in the first successive step In, the background layer of original picture is mainly adjusted to target shape size, wherein, the ratio of width to height and original picture in target shape size The ratio of width to height it is different.Optionally, during background layer adjusts, the content element on background layer can be both based in original picture Content element and background layer between patterning positions keep it is constant, can also be carried out with the change of background layer displacement and/ Or enter the adjustment of the proportional zooms such as line width height.Outside the background layer appearance and size and target of the first adjustment picture obtained after first successive step Shape size is identical.
According to the magnitude relationship between artwork chip size and target shape size, the background layer of original picture is adjusted to first When adjusting the background layer of picture, it the operation such as may be stretched, compress, cut to the background layer of original picture, based on this, by artwork The specific method that piece is adjusted to the first adjustment picture is also different, and a point situation illustrates below.
Optionally, in one embodiment of the invention, the background layer to the original picture and on the background layer Content element be adjusted to obtain the first adjustment picture and may include:
In the width for being wider than the original picture of the target shape size, and/or the target shape size is tall and big In the case of the height of the original picture, the background layer of the original picture can be stretched accordingly, so that after stretching The appearance and size of the background layer and the target shape are equal sized;
According to the wide and/or high draw ratio to the background layer, the ratios such as line width height are entered to the content element and put Greatly picture is adjusted to obtain described first.
For example, target shape size is 150*200, the size of original picture is 100*100, then needs to original picture 1.5 times of the width tension of background layer, 2 times of high elongation, the background layer of the first adjustment picture is set to be changed into 150*200.Then basis To the wide and/or high draw ratio of background layer, it is scaling to enter line width height etc. to content element, such as can be in original picture Content element enter scaling 1.5 times or 2 times of line width height etc., obtain the first adjustment picture.Content member in original picture When the wide high ratio of element amplifies 1.5 times, the border of content element adjusts the profile boundaries of the background layer of picture without departing from first, when When high ratio wide to the content element in original picture amplifies 2 times, the border of content element is then possible to beyond the first adjustment picture Background layer profile boundaries.Certainly, in another embodiment of the present invention, can also integrate to the wide and high of background layer Different magnification ratios determine the magnification ratio to content element, for example, 1.7 times are all amplified to the wide and high of content element, this Sample is on the premise of the height for ensureing content element is no more than background layer height, it is possible to makes the width of content element also without super Go out the width of background layer.It is specific how according to the magnification ratio of background layer to determine that the magnification ratio of content element be according to reality Border situation selects different algorithms, and embodiments of the invention are not construed as limiting to this.
Optionally, in another embodiment of the present invention, the background layer to the original picture and positioned at the background layer On content element be adjusted to obtain the first adjustment picture and may include:
It is less than the width of the original picture in the width of the target shape size, and/or the target shape size is high small In the case of the height of the original picture, the background layer of the original picture is compressed accordingly, so that described after compression The appearance and size of background layer and the target shape are equal sized;
According to the wide and/or high compression multiple to the background layer, the contracting of the ratios such as line width height is entered to the content element It is small to adjust picture to obtain described first.
For example, target shape size is 50*200, the size of original picture is 50*100, then needs the back of the body of original picture The width of background layer keeps constant, 2 times of high compression, the background layer of the first adjustment picture is changed into 50*200.Then according to the back of the body The wide and/or high compression multiple of background layer, the scale smallers such as line width height are entered to content element.Such as can be in original picture Hold element to enter 2 times of the scale smallers such as line width height or keep constant, obtain the first adjustment picture.Content element in original picture During 2 times of wide high Scaling, holding is worked as in the border of content element without departing from the profile boundaries of the background layer of the first adjustment picture When content element in original picture is constant, the border of content element is then possible to the profile of the background layer beyond the first adjustment picture Border.Certainly, in another embodiment of the present invention, it can also integrate and the wide and high different magnification ratios of background layer are come It is determined that to the magnification ratio of content element, for example, all reducing 1.6 times to the wide and high of content element, so ensureing content member On the premise of the width of element is no more than background layer width, it is possible to make the height of content element also without departing from the height of background layer Degree.It is specific how according to the magnification ratio of background layer to determine that the diminution ratio of content element be according to actual conditions from not Same algorithm, embodiments of the invention are not construed as limiting to this.
Optionally, there is one embodiment in the present invention, background layer to original picture and on the background layer Content element, which is adjusted to obtain the first adjustment picture, may include:It is less than the original picture in the width of the target shape size In the case of width, and/or height of the height less than the original picture of the target shape size, the background layer of the original picture is entered Row is cut, so that the appearance and size of the background layer after cutting and the target shape are equal sized.Due to cutting only pin To be background layer, therefore the content element in original picture will not be damaged because of cutting.Content element can cut Keep constant in journey, can also suitably be shifted along direction is cut, suitably scaled down, reality of the invention can also be carried out Example is applied to be not construed as limiting this.
For example, in one embodiment of the invention, if as shown in Fig. 2 carried out from right to left to background layer Unilateral (arrow logo change direction) during cutting adjustment, the border of background layer are not yet (empty with the rectangle frame of content element Shown in wire frame) any segment boundary overlap, then content element can be kept constant, wherein, Fig. 2 (A) represents previous moment Image effect, Fig. 2 (B) represent the image effect of later moment in time;As shown in figure 3, when background layer border in adjustment with rectangle When any segment boundary of frame overlaps, then the content element in rectangle frame can be avoided and the border of background layer weight by translating Close, wherein, Fig. 3 (A) represents the image effect of previous moment, and Fig. 3 (B) represents the image effect of later moment in time.
It is as shown in figure 4, equal sized when the size in a certain lateral boundaries of background layer and any bar frame of rectangle frame When, if background layer continues to reduce size in the lateral boundaries, rectangle frame can correspondingly reduce the size of the frame, simultaneously The size of other frames is set also to reduce according to same ratio, i.e. the content element in rectangle frame is entered the scale smallers such as line width height. Wherein, Fig. 4 (A) represents the image effect of previous moment, and Fig. 4 (B) represents the image effect of later moment in time.
It should be noted that above-described embodiment is only the simplified example of picture adjustment, and in the specific implementation, stretching, pressure The operation such as contract, amplify, reducing, cutting with various combinations while can be applied, the present invention in an image adaptation procedures Embodiment this is not construed as limiting.
After obtaining the first adjustment picture, at least in appearance and size, the first adjustment picture is identical with Target Photo. What is done below is exactly to adjust the content element in picture by first to do further adjustment, to allow content element in background With proper size and position display in layer.
Due in first successive step, the background layer of original picture being forced to be adjusted to target shape size, and in original picture Content element does not synchronize adjustment with background layer, accordingly, it is possible to have the border of part or all of content element beyond the The situation of the profile boundaries of the background layer of one adjustment picture, referring specifically to being described above.In order to obtain suitable Target Photo, need First adjustment picture is further processed.Specifically, it may be determined that whether adjusted beyond first on the border of content element The profile boundaries of the background layer of whole picture;On the border of the content element beyond the outer of the background layer of the described first adjustment picture In the case of shape border, picture is adjusted by carrying out protectiveness adjustment to content element.Optionally, protectiveness adjustment can Including displacement and/or wide high scaled down.
It both can be acquiescence due to the border of content element or set according to instruction.In order that content is first Element obtains suitable border, in one embodiment of the invention, after the importing of original picture is received, to the original picture Before being adjusted to obtain the first adjustment picture, it may also include:Element protecting frame is set for the content element, with the element Border of the frame of protecting frame as the content element.Wherein, element protecting frame can be set in several ways.Example Such as, element protecting frame can be irised out around preset content element according to touch command or mouse drag instruction, can also passed through Specify the inset spacing of preset content element that element protecting frame is set for preset content element.When carrying out inset spacing setting, each Preset content element can correspond to one group of inset spacing, for the element protecting frame for representing preset content element and same preset content Frame distance between the boundary rectangle frame of element.For example, one group of inset spacing may include element protecting frame and boundary rectangle frame it Between upper side frame spacing, lower frame spacing, left frame spacing and left frame spacing.
Protectiveness adjustment is specifically described below by citing.In one embodiment of the invention, target shape Size is 150*200, and the size of original picture is 100*100, during the first adjustment picture is obtained, in original picture When the wide high ratio of content element amplifies 1.5 times, then the border of content element is outer without departing from the background layer of the first adjustment picture Shape border, when the wide high ratio of the content element in original picture amplifies 2 times, the border of content element is then possible to exceed first Adjust the profile boundaries of the background layer of picture.When the border for detecting content element exceeds the background layer of the first adjustment picture really Profile boundaries when, can to the content element carry out protectiveness adjustment (shift and/or enter the scale smallers such as line width height), make this Content element is come back in background layer, forms adjustment picture.In this manner it is possible to some occurred in picture are adjusted to first not It is suitable to be finely adjusted, so that content element is appeared in picture with more suitably size and position.
When carrying out protectiveness adjustment to content element by displacement, the displacement can be based on content element in original picture Relative position carry out.In order that adjustment after figure layer in content element position as far as possible and its position pair in original picture Should, normalized coordinate system can be established in original picture, center picture is origin, origin (0.5,0.5), two coordinates The coordinate range of axle is [0,1].If the position coordinates of certain content element is (0.2,0.3) in original picture, then adjusting In picture, the default location coordinate of the content element is still (0.2,0.3).If because the high not uniform zoom of the width of figure layer causes The position of the pre-set image content is less suitable, then can further be adjusted based on the coordinate.
Further, background layer and content element are still separate in the adjustment picture obtained, can not be directly as Picture uses.In order to obtain the picture for being easy to application, specifically, in step s 13, can deposit by screenshotss, snapshot or separately Mode will adjust picture output to obtain Target Photo., can also basis after exporting to obtain Target Photo by adjustment picture Picture download request externally sends Target Photo.Moreover, in order to still said process be utilized to generate in work afterwards A series of pictures file, above-mentioned parameter can be set and the specific adjustment algorithm of picture is all saved in high in the clouds.
It should be noted that in the embodiment of the present invention, the adjustment of picture both can in terminal or server independent operating, Webpage WEB editing environments can also be utilized to run.Import web page editing instrument for example, original picture can be layered or visually melt Feel like jelly in part, under web page editing environment, Html (HyperText Markup Language, hypertext markup language can be utilized Speech) language grammer structure picture adjustment rule.In order to preferably support the regulation to dimension of picture, web page editing ring Border is preferably the web page editing environment for supporting response type algorithm.So, it is only necessary to which dynamic adjusts the size of web page editing window, makes The size of the window of web page editing environment gradually changes according to a certain rule, you can according to response type algorithm by page structure in window The size of figure is changed more accordingly, so as to smoothly obtain the pages required, that the ratio of width to height is different from original picture Composition.Wherein, the change procedure of web page editing window can not be shown, only in running background.
Picture Generation Method provided by the invention is described in detail below by specific embodiment.
Fig. 5 is the structural representation of original picture and the new picture (i.e. Target Photo) of generation in one embodiment of the present of invention Figure.Fig. 5 clearly illustrates the structure of the new picture of original picture, content element, background layer and generation.Fig. 6 is shown in Fig. 5 A kind of flow chart of the generation method of picture.With reference to Fig. 5 and Fig. 6, the Picture Generation Method that embodiments of the invention provide can wrap Include:
S201, the importing of original picture is received, wherein A, B, C, D is four content elements, is separately positioned in background layer;Such as Shown in Fig. 5, content element A is the pattern in the upper left corner in figure, and content element B is middle " Gift Card " pattern, and content element C is Middle animal pattern, content element D are the icon in the lower right corner.
S202, respectively picture material A, B, C, D set element protecting frame, i.e., the side of each content element is surrounded in figure Frame;Optionally, can also be that editor's information sets element protecting frame if picture includes editing information;
S203, according to the appearance and size of original picture and one or more target shape size (appearance and sizes to be generated Can be represented by modes such as resolution ratio), the patterning positions between content element and background layer in the original picture, to described Original picture is adjusted to obtain the first adjustment picture, the background layer appearance and size of the first adjustment picture and the target shape Size is identical;Wherein, the ratio of width to height of the target shape size is different from the ratio of width to height of the original picture.
Optionally, the pixel resolution of the pixel resolution of original picture and a series of pictures to be generated can be typing Or choose, embodiments of the invention are not limited this.
S204, determine in the first adjustment picture, whether the border of the content element schemes beyond the described first adjustment The profile boundaries of the background layer of piece;
S205, the situation on the border of the content element beyond the profile boundaries of the background layer of the described first adjustment picture Under, the content element is shifted and/or enters the scale smallers such as line width height it is adjusted picture;In the adjustment picture In, the border of the content element is in the profile boundaries of the adjustment picture;
S206, sectional drawing being carried out to adjustment picture, and picture is exported and preserved, picture format can be JPG, PNG, GIF etc., So as to which moment completes the change and output of tens hundreds of sizes.Optionally, the form that can use title+numbering is each picture text Part is named, the various sizes of image file of batch signatures.
S207, picture Adjusted Option and parameter setting are preserved to cloud system, so as to later use and improvement.
Second aspect, the embodiment of the present invention provide a kind of photograph creation device, and the treatment effect of picture is preferable, can solve the problem that Easily cause what the picture material in picture was deformed or lacked when entering the high inequality proportion of line width to picture and adjusting in the prior art Problem.
As shown in fig. 7, a kind of photograph creation device 3 that embodiments of the invention provide, including:Receiving unit 31, is used for The importing of original picture is received, the original picture includes background layer and the content element on the background layer;Adjustment unit 32, For the patterning positions between the content element and background layer in default target shape size, the original picture, to institute The background layer and the content element on the background layer for stating original picture are adjusted and are adjusted picture;Wherein, the tune The background layer appearance and size of whole picture is identical with the target shape size, the ratio of width to height in the target shape size with it is described The ratio of width to height of original picture is different;In the adjustment picture, the ratio of width to height of the content element and the content in the original picture The ratio of width to height of element is identical, and the border of the content element is in the profile boundaries of the adjustment picture;Output unit 33, For the adjustment picture to be exported to obtain the Target Photo with the target shape size.
The photograph creation device that embodiments of the invention provide, can make the content on the background layer and background layer of picture Element is adjusted respectively is adjusted picture, and the background layer appearance and size of the adjustment picture is identical with target shape size, In picture is adjusted, the ratio of width to height of the content element is identical and described with the ratio of width to height of the content element in the original picture The border of content element obtains Target Photo in the profile boundaries of the adjustment picture, according to adjustment picture, so, is protecting In the case that content element in card picture is not distorted, the ratio of width to height Target Photo different from original picture can be generated, is had Imitate to solve and easily cause what the picture material in picture was deformed or lacked in the width height progress inequality proportion adjustment to picture Problem, substantially increase picture quality.
Optionally, the adjustment unit includes:First adjustment subelement, for being adjusted to obtain the to the original picture One adjustment picture, the background layer appearance and size of the first adjustment picture are identical with the target shape size;Determination subelement, For determining in the first adjustment picture, whether the border of the content element is beyond the described first background layer for adjusting picture Profile boundaries;Second adjustment subelement, for the background on the border of the content element beyond the described first adjustment picture In the case of the profile boundaries of layer, protectiveness is carried out to the content element and adjusts to obtain the adjustment picture.
Optionally, the protectiveness adjustment may include displacement and/or wide high scaled down.
Further, the photograph creation device may also include:Setting unit, for receive original picture importing after, Before being adjusted to obtain the first adjustment picture to the original picture, element protecting frame is set for the content element, with institute State border of the frame of element protecting frame as the content element.
Optionally, the first adjustment subelement may include:Background stretching module, in the roomy of the target shape size In the width of the original picture, and/or the target shape size is tall and big in the case of the height of the original picture, to the original The background layer of picture is stretched accordingly, so that the appearance and size of the background layer after stretching and the target shape size It is equal;Element amplification module, for according to the wide and/or high draw ratio to the background layer, entering to the content element Line width height etc. is scaling to adjust picture to obtain described first.
Optionally, the first adjustment subelement may include:Background compression module, in the wide small of the target shape size In the case that the height of the width of the original picture, and/or the target shape size is less than the height of the original picture, to the original The background layer of picture is compressed accordingly, so that the appearance and size of the background layer after compression and the target shape size It is equal;Element reduces module, for according to the wide and/or high compression multiple to the background layer, entering to the content element The high scaled down of line width adjusts picture to obtain described first.
Optionally, the first adjustment subelement may include:Background cuts module, in the wide small of the target shape size In the case that the height of the width of the original picture, and/or the target shape size is less than the height of the original picture, to the original The background layer of picture is cut, so that the appearance and size of the background layer after cutting and the target shape are equal sized.
Optionally, output unit 33, specifically for exporting the adjustment picture by way of depositing screenshotss, snapshot or separately To obtain that there is the Target Photo of the target size.
Optionally, the photograph creation device may also include transmitting element, for exporting and being had by the adjustment picture After the Target Photo for having the target shape size, the Target Photo is externally sent according to picture download request.
The third aspect, the embodiment of the present invention provide a kind of electronic equipment, and the treatment effect of picture is preferable, can solve the problem that existing The problem of easily causing the picture material in picture to deform or lack when entering the high inequality proportion of line width to picture and adjusting in technology.
As shown in figure 8, a kind of electronic equipment that embodiments of the invention provide, can include:Housing 41, processor 42, Memory 43, circuit board 44 and power circuit 45, wherein, circuit board 44 is placed in the interior volume that housing 41 surrounds, processor 42 and memory 43 be arranged on circuit board 44;Power circuit 45, for each circuit or the device confession for above-mentioned electronic equipment Electricity;Memory 43 is used to store executable program code;Processor 42 is by reading the executable program stored in memory 43 Code runs program corresponding with executable program code, for performing the picture generation side described in foregoing any embodiment Method.
Processor 42 to the specific implementation procedures of above-mentioned steps and processor 42 by run executable program code come The step of further performing, the description of previous embodiment is may refer to, will not be repeated here.
The electronic equipment exists in a variety of forms, includes but is not limited to:
(1) mobile communication equipment:The characteristics of this kind equipment is that possess mobile communication function, and to provide speech, data Communicate as main target.This Terminal Type includes:Smart mobile phone (such as iPhone), multimedia handset, feature mobile phone, and it is low Hold mobile phone etc..
(2) super mobile personal computer equipment:This kind equipment belongs to the category of personal computer, there is calculating and processing work( Can, typically also possess mobile Internet access characteristic.This Terminal Type includes:PDA, MID and UMPC equipment etc., such as iPad.
(3) portable entertainment device:This kind equipment can show and play content of multimedia.The kind equipment includes:Audio, Video player (such as iPod), handheld device, e-book, and intelligent toy and portable car-mounted navigation equipment.
(4) server:The equipment for providing the service of calculating, the composition of server are total including processor, hard disk, internal memory, system Line etc., server is similar with general computer architecture, but due to needing to provide highly reliable service, therefore in processing energy Power, stability, reliability, security, scalability, manageability etc. require higher.
(5) other electronic equipments with data interaction function.
Fourth aspect, embodiments of the invention also provide a kind of computer-readable recording medium, described computer-readable to deposit Storage media is stored with one or more program, one or more of programs can by one or more computing device, To realize any Picture Generation Method of previous embodiment offer, therefore corresponding technique effect can be also realized, above It is described in detail, here is omitted.
5th aspect, embodiments of the invention also provide a kind of application program, and the application program can be performed, to realize Any Picture Generation Method that previous embodiment provides, therefore corresponding technique effect can be also realized, have been carried out above Describe in detail, here is omitted.
It should be noted that herein, such as first and second or the like relational terms are used merely to a reality Body or operation make a distinction with another entity or operation, and not necessarily require or imply and deposited between these entities or operation In any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant are intended to Nonexcludability includes, so that process, method, article or equipment including a series of elements not only will including those Element, but also the other element including being not expressly set out, or it is this process, method, article or equipment also to include Intrinsic key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that Other identical element also be present in process, method, article or equipment including the key element.
Each embodiment in this specification is described by the way of related, identical similar portion between each embodiment Divide mutually referring to what each embodiment stressed is the difference with other embodiment.
For device embodiment, because it is substantially similar to embodiment of the method, so the comparison of description is simple Single, the relevent part can refer to the partial explaination of embodiments of method.
For convenience of description, it is to be divided into various units/modules with function to describe respectively to describe apparatus above.Certainly, exist The function of each unit/module can be realized in same or multiple softwares and/or hardware when implementing of the invention.
One of ordinary skill in the art will appreciate that realize all or part of flow in above-described embodiment method, being can be with The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (RandomAccess Memory, RAM) etc..
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any Those familiar with the art the invention discloses technical scope in, the change or replacement that can readily occur in, all should It is included within the scope of the present invention.Therefore, protection scope of the present invention should be defined by scope of the claims.

Claims (10)

  1. A kind of 1. Picture Generation Method, it is characterised in that including:
    The importing of original picture is received, the original picture includes background layer and the content element on the background layer;
    The patterning positions between content element and background layer in default target shape size, the original picture, to institute The background layer and the content element on the background layer for stating original picture are adjusted and are adjusted picture;Wherein, the tune The background layer appearance and size of whole picture is identical with the target shape size, the ratio of width to height in the target shape size with it is described The ratio of width to height of original picture is different;In the adjustment picture, the ratio of width to height of the content element and the content in the original picture The ratio of width to height of element is identical, and the border of the content element is in the profile boundaries of the adjustment picture;
    The adjustment picture is exported to obtain the Target Photo with the target shape size.
  2. 2. according to the method for claim 1, it is characterised in that described according to default target shape size, the artwork The patterning positions between content element and background layer in piece, background layer to the original picture and on the background layer Content element, which is adjusted, to be adjusted picture and includes:
    The original picture is adjusted to obtain the first adjustment picture, the background layer appearance and size of the first adjustment picture and institute It is identical to state target shape size;
    Determine in the first adjustment picture, whether the border of the content element is beyond the described first background layer for adjusting picture Profile boundaries;
    In the case where the border of the content element is beyond the profile boundaries of the background layer of the described first adjustment picture, to described Content element carries out protectiveness and adjusts to obtain the adjustment picture.
  3. 3. according to the method for claim 2, it is characterised in that the protectiveness adjustment includes displacement and/or wide high ratio Example reduces.
  4. 4. according to the method for claim 2, it is characterised in that described that the original picture is adjusted to obtain the first adjustment Picture includes:
    In the width for being wider than the original picture of the target shape size, and/or the target shape size is tall and big in institute In the case of the height for stating original picture, the background layer of the original picture is stretched accordingly, so that the background after stretching The appearance and size and the target shape of layer are equal sized;
    According to the wide and/or high draw ratio to the background layer, the content element is entered line width height etc. it is scaling with Obtain the first adjustment picture.
  5. 5. according to the method for claim 2, it is characterised in that described that the original picture is adjusted to obtain the first adjustment Picture includes:
    It is less than the width of the original picture in the width of the target shape size, and/or the height of the target shape size is less than institute In the case of the height for stating original picture, the background layer of the original picture is compressed accordingly, so that the background after compression The appearance and size and the target shape of layer are equal sized;
    According to the wide and/or high compression multiple to the background layer, the content element is entered the scale smallers such as line width height with Obtain the first adjustment picture.
  6. 6. according to the method for claim 2, it is characterised in that described that the original picture is adjusted to obtain the first adjustment Picture includes:
    It is less than the width of the original picture in the width of the target shape size, and/or the height of the target shape size is less than institute In the case of the height for stating original picture, the background layer of the original picture is cut, so that the background layer after cutting is outer Shape size and the target shape are equal sized.
  7. 7. method according to any one of claim 1 to 6, it is characterised in that described to export the adjustment picture Include to the Target Photo with the target shape size:
    The adjustment picture is exported to obtain having the mesh of the target shape size by way of depositing screenshotss, snapshot or separately Mark on a map piece.
  8. A kind of 8. photograph creation device, it is characterised in that including:
    Receiving unit, for receiving the importing of original picture, the original picture include background layer and on the background layer in Hold element;
    Adjustment unit, between the content element and background layer in default target shape size, the original picture Patterning positions, the background layer to the original picture and the content element on the background layer, which are adjusted, is adjusted figure Piece;Wherein, the background layer appearance and size of the adjustment picture is identical with the target shape size, in the target shape size The ratio of width to height it is different from the ratio of width to height of the original picture;It is described adjustment picture in, the ratio of width to height of the content element with it is described The ratio of width to height of content element in original picture is identical, and the border of the content element is positioned at the profile boundaries of the adjustment picture It is interior;
    Output unit, for exporting to obtain the Target Photo with the target shape size adjustment picture.
  9. 9. a kind of electronic equipment, it is characterised in that the electronic equipment includes:Housing, processor, memory, circuit board and electricity Source circuit, wherein, circuit board is placed in the interior volume that housing surrounds, and processor and memory are set on circuit boards;Power supply Circuit, for each circuit or the device power supply for above-mentioned electronic equipment;Memory is used to store executable program code;Processing The executable program code that device is stored by reading in memory runs program corresponding with executable program code, for holding Picture Generation Method described in any one of row preceding claims 1 to 7.
  10. A kind of 10. computer-readable recording medium, it is characterised in that the computer-readable recording medium storage have one or Multiple programs, one or more of programs can by one or more computing device, with realize preceding claims 1 to Picture Generation Method any one of 7.
CN201710914775.3A 2017-09-29 2017-09-29 Picture generation method and device, electronic equipment and storage medium Pending CN107590848A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710914775.3A CN107590848A (en) 2017-09-29 2017-09-29 Picture generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710914775.3A CN107590848A (en) 2017-09-29 2017-09-29 Picture generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN107590848A true CN107590848A (en) 2018-01-16

Family

ID=61052704

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710914775.3A Pending CN107590848A (en) 2017-09-29 2017-09-29 Picture generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN107590848A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111540033A (en) * 2019-01-18 2020-08-14 北京京东尚科信息技术有限公司 Image production method and device, browser, computer equipment and storage medium
CN112508785A (en) * 2020-11-28 2021-03-16 华为技术有限公司 Picture processing method and device
CN113064684A (en) * 2021-01-18 2021-07-02 海信视像科技股份有限公司 Virtual reality equipment and VR scene screen capturing method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101489147A (en) * 2009-01-16 2009-07-22 西安电子科技大学 Width/height ratio conversion method based on interested region
US20160173789A1 (en) * 2014-07-02 2016-06-16 Sony Corporation Image generation method and apparatus, and mobile terminal
CN106157239A (en) * 2015-04-22 2016-11-23 阿里巴巴集团控股有限公司 A kind of image processing method and relevant device and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101489147A (en) * 2009-01-16 2009-07-22 西安电子科技大学 Width/height ratio conversion method based on interested region
US20160173789A1 (en) * 2014-07-02 2016-06-16 Sony Corporation Image generation method and apparatus, and mobile terminal
CN106157239A (en) * 2015-04-22 2016-11-23 阿里巴巴集团控股有限公司 A kind of image processing method and relevant device and system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111540033A (en) * 2019-01-18 2020-08-14 北京京东尚科信息技术有限公司 Image production method and device, browser, computer equipment and storage medium
CN112508785A (en) * 2020-11-28 2021-03-16 华为技术有限公司 Picture processing method and device
WO2022111660A1 (en) * 2020-11-28 2022-06-02 花瓣云科技有限公司 Picture processing method and apparatus
CN113064684A (en) * 2021-01-18 2021-07-02 海信视像科技股份有限公司 Virtual reality equipment and VR scene screen capturing method

Similar Documents

Publication Publication Date Title
US11200372B2 (en) Calculations on images within cells in spreadsheets
KR101298370B1 (en) Acceleration of rendering of web-based content
CN101620507B (en) Mobile terminal using proximity sensor and method of controlling the mobile terminal
CN107590848A (en) Picture generation method and device, electronic equipment and storage medium
CN103279496A (en) Terminal and display method of associated information
CN103605783A (en) Webpage display method and device
US20230005506A1 (en) Audio processing method and electronic device
US9256919B2 (en) Systems and methods for image processing using a resizing template
CN107767431B (en) Web animation production method and computing device
CN111159594A (en) Information processing method, information processing device and terminal equipment
CN105045587B (en) A kind of picture display method and device
WO2017180355A1 (en) Dynamically formatting scalable vector graphics
CN111191176B (en) Website content updating method, device, terminal and storage medium
CN109902282B (en) Text typesetting method, text typesetting device and storage medium
US9454798B2 (en) Systems and methods of automatic image sizing
KR101746052B1 (en) Method and apparatus for providing e-book service in a portable terminal
CN105740213A (en) Presentation template providing method and device
CN107786630A (en) A kind of web applications packet processing method, device and equipment
CN115794276A (en) Display page component adaptation method and device, computer equipment and storage medium
CN105608152A (en) Method and device for asynchronously loading webpage resources
CN107390986A (en) A kind of mobile terminal cuts out figure control method, storage device and mobile terminal
CN105867868A (en) Image display method and image display terminal
CN103218413B (en) A kind of electronic document synthetic method and device
CN107146245A (en) image matching method and device
JP5547917B2 (en) Content generation / distribution system for portable information terminals

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: 20180116

RJ01 Rejection of invention patent application after publication