CN106157239A - A kind of image processing method and relevant device and system - Google Patents

A kind of image processing method and relevant device and system Download PDF

Info

Publication number
CN106157239A
CN106157239A CN201510194908.5A CN201510194908A CN106157239A CN 106157239 A CN106157239 A CN 106157239A CN 201510194908 A CN201510194908 A CN 201510194908A CN 106157239 A CN106157239 A CN 106157239A
Authority
CN
China
Prior art keywords
picture
original picture
information
core
original
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.)
Granted
Application number
CN201510194908.5A
Other languages
Chinese (zh)
Other versions
CN106157239B (en
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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201510194908.5A priority Critical patent/CN106157239B/en
Publication of CN106157239A publication Critical patent/CN106157239A/en
Application granted granted Critical
Publication of CN106157239B publication Critical patent/CN106157239B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Processing Or Creating Images (AREA)
  • Image Processing (AREA)

Abstract

This application discloses a kind of image processing method and relevant device and system, can be according to the dimension information of Target Photo, cutting is carried out to carrying the original image setting nucleus information, obtain comprising the cutting picture that the nucleus of original image and picture ratio are identical with the picture ratio of Target Photo, and according to the dimension information of Target Photo and the dimension information of cutting picture, cutting picture is zoomed in and out, obtain comprising the equivalently-sized result picture of the nucleus of original image and size and Target Photo, thus can be on the basis of the nucleus ensureing original image mistake cutting and then is not improved the degree of accuracy that picture is adaptive, difficulty that when many size scene throw in picture materials adaptive is greatly lowered.

Description

Picture processing method and related equipment and system
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an image processing method, and a related device and system.
Background
When a terminal user puts the same picture material into different target scenes, the terminal user often needs to correspondingly adjust the picture material according to the sizes required by the target scenes.
For example, if the size required by the target scene is different from the size of the picture material, but the picture proportion required by the target scene is the same as the picture proportion of the picture material, the picture material may be scaled by using a picture scaling method, so as to obtain a picture which has the same picture proportion as the picture material and meets the size required by the target scene. For another example, if the size required by the target scene is different from the size of the picture material, and the picture proportion required by the target scene is different from the picture proportion of the picture material, the picture material may be zoomed in a zooming manner without maintaining the picture proportion, so as to obtain a picture meeting the size required by the target scene.
That is to say, at present, the picture scaling scheme can only be applied to the situation that the picture proportion required by the target scene is the same as the picture proportion of the picture material, but because the proportion of the situation in the picture delivery scene is very low, in most cases, the picture scaling scheme cannot meet the actual requirement, and the picture material needs to be scaled by using a scaling mode that does not maintain the picture proportion, or the terminal user is directly instructed to manually upload the picture that meets the picture proportion and size required by the target scene.
However, when the scaling method that does not maintain the picture scale is used to scale the picture material, the picture is distorted to a large extent, so that the finally-put picture is inaccurate, the display effect is poor, and the actual requirements of the user cannot be met. In addition, if the terminal user is required to upload different pictures meeting the requirements of corresponding target scenes for different target scenes, on one hand, the speed of putting the pictures into the whole chain can be greatly reduced, and on the other hand, a large amount of picture storage resources and picture putting resources can be occupied.
That is to say, in the existing picture delivery scenes, there is a problem that the single picture material cannot meet the size requirements of numerous delivery scenes, resulting in high difficulty in adapting the picture material when delivering multiple-size scenes.
Disclosure of Invention
The embodiment of the application provides a picture processing method, and related equipment and system, which are used for solving the problem that the difficulty of picture material adaptation is high when a multi-size scene is launched at present.
The embodiment of the application provides a picture processing method, which comprises the following steps:
the method comprises the steps that a server receives a picture acquisition request which is initiated by a first terminal and aims at an original picture carrying set core area information, wherein the picture acquisition request carries size information of a target picture required by the first terminal;
according to the size information of the target picture, cutting the original picture to obtain a cut picture which contains a core area of the original picture and has the same picture proportion as that of the target picture;
and zooming the cut picture according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the size same as that of the target picture, and returning the result picture to the first terminal.
Further, an embodiment of the present application further provides another picture processing method, including:
a first terminal initiates a picture acquisition request aiming at an original picture carrying set core area information to a server, wherein the picture acquisition request carries size information of a target picture required by the first terminal;
receiving a result picture returned by the server according to the picture acquisition request, and taking the result picture as a required target picture; and the result picture is a picture which contains the core area of the original picture and is obtained by the server according to the size information of the target picture, and the size and the picture proportion of the core area are respectively the same as those of the target picture.
Accordingly, an embodiment of the present application provides a server, including:
a receiving unit, configured to receive an image acquisition request for an original image carrying information of a set core area, where the image acquisition request carries size information of a target image required by a first terminal, where the image acquisition request is initiated by the first terminal;
the cutting unit is used for cutting the original picture according to the size information of the target picture to obtain a cut picture which contains a core area of the original picture and has the same picture proportion as that of the target picture;
the zooming unit is used for zooming the cut picture according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the size same as that of the target picture;
and the sending unit is used for returning the result picture to the first terminal.
Further, an embodiment of the present application further provides a terminal, including:
a sending unit, configured to initiate, to a server, a picture acquisition request for an original picture carrying information of a set core area, where the picture acquisition request carries size information of a target picture required by the terminal;
the receiving unit is used for receiving a result picture returned by the server according to the picture acquisition request and taking the result picture as a required target picture; and the result picture is a picture which contains the core area of the original picture and is obtained by the server according to the size information of the target picture, and the size and the picture proportion of the core area are respectively the same as those of the target picture.
Further, an embodiment of the present application further provides an image processing system, including:
the server is used for receiving a picture acquisition request which is initiated by a first terminal and aims at an original picture carrying set core area information, wherein the picture acquisition request carries size information of a target picture required by the first terminal; cutting the original picture according to the size information of the target picture to obtain a cut picture which contains a core area of the original picture and has the same picture proportion as that of the target picture; zooming the cut picture according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the size same as that of the target picture, and returning the result picture to the first terminal;
the first terminal is used for initiating a picture acquisition request aiming at an original picture carrying set core area information to a server, receiving a result picture returned by the server according to the picture acquisition request, and taking the result picture as a required target picture.
The beneficial effect of this application is as follows:
the embodiment of the application provides a picture processing method, related equipment and a system, which can cut an original picture carrying set core area information according to size information of a target picture to obtain a cut picture containing a core area of the original picture and having the same picture proportion as that of the target picture, and zoom the cut picture according to the size information of the target picture and the size information of the cut picture to obtain result pictures containing the core area of the original picture and having the same size, the same picture proportion as that of the target picture and the same picture proportion as that of the target picture, so that the difficulty of picture material adaptation during multi-size scene delivery can be greatly reduced on the basis of ensuring that the core area of the original picture is not cut by mistake and further improving the accuracy of picture adaptation.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart illustrating a picture processing method according to a first embodiment of the present application;
fig. 2 is a schematic flowchart illustrating a picture processing method according to a second embodiment of the present application;
fig. 3 is a schematic flowchart illustrating a picture processing method according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of the server according to the fourth embodiment of the present application;
fig. 5 is a schematic structural diagram of a terminal according to a fourth embodiment of the present application;
fig. 6 is a schematic structural diagram of the image processing system according to the fourth embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be described in further detail with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The first embodiment is as follows:
an embodiment of the present application provides a picture processing method, as shown in fig. 1, which is a schematic flow chart of the picture processing method in the first embodiment of the present application, and the method may include the following steps:
step 101: the method comprises the steps that a server receives a picture obtaining request which is initiated by a first terminal and aims at an original picture carrying set core area information, wherein the picture obtaining request carries size information of a target picture required by the first terminal.
Optionally, in the step 101, the picture obtaining request may be initiated by the first terminal to the server through a Hyper Text Transfer Protocol (HTTP) API (Application programming interface), or initiated by the first terminal to the server according to a program call instruction issued by another program, which is not limited in this embodiment of the present invention. In addition, the picture obtaining request may also be initiated by the first terminal based on address information of the original picture, such as a Uniform Resource Locator (URL) of the original picture, and the like, which is not described in detail in this embodiment of the present application.
Step 102: and according to the size information of the target picture, cutting the original picture to obtain a cut picture which contains the core area of the original picture and has the same picture proportion as that of the target picture.
Optionally, in the step 102, the server may crop the original picture in a cropping manner of extending pixels to the periphery based on the core area of the original picture according to the size information of the target picture, so as to ensure that the core area information of the original picture is not cropped incorrectly.
For example, the server may determine a clipping region according to which the original picture is clipped, in a manner of extending pixels to the periphery based on a core region of the original picture; and according to the cutting area, cutting the original picture to obtain a cut picture which comprises a core area of the original picture and has the same picture proportion as that of the target picture, wherein the cutting area comprises the core area of the original picture and has the corresponding picture proportion as that of the target picture.
It should be noted that, in the embodiments described in the present application, if there is no special description, the picture ratio of a picture may generally refer to an aspect ratio of the picture, and of course, may also refer to an aspect ratio of the picture, which is not described herein again in this application. In addition, each picture (e.g., the original picture) in the embodiment of the present application may be a picture in any format, such as a picture conforming to an Exif (Exchangeable image file) standard, and the like, which is not described in detail in this embodiment of the present application.
Specifically, determining a clipping region according to which the original picture is clipped in a manner of extending pixels to the periphery based on the core region of the original picture may include:
starting coordinate point (x) of core area of the original picturecore,ycore) Set as the starting coordinate point (x) of the cutting areafinal,yfinal) (ii) a Wherein a start coordinate point (x) of a core region of the original picturecore,ycore) Can be based on the preset core area information of the original pictureDetermining, wherein the preset core area information of the original picture may generally include starting coordinate point information of the core area of the original picture, and size information of the core area of the original picture, such as width WcoreHeight HcoreAnd the like;
calculating the width W of the core area of the original picture when the width of the cutting area iscoreWhen the target picture is matched with the picture Ratio of the target picturetargetInitial height H oftemp(ii) a Wherein the picture Ratio of the target picturetargetCan be determined according to the size information (such as width and height) of the target picture;
if the initial height H is determinedtempHeight H larger than core area of the original picturecoreIt means that the pixels need to be extended in the vertical direction on the basis of the core area of the original picture, and thus, the vertical extensible pixel height H of the original picture can be calculatedavailable=Horiginal–HtempWherein, the HoriginalIs the height of the original picture; and determining said HavailableNot less than Htemp–HcoreThen, the height H of the pixel needing to be filled currently is determinedneeded=Htemp–HcoreAnd according to said HneededExpanding pixels equally to two sides of a longitudinal axis of a core region of the original picture until determining that no usable pixel exists on any one side of the two sides of the longitudinal axis of the core region of the original picture, and continuing to expand the pixels to the other side of the two sides of the longitudinal axis until determining that the height of the expanded region is equal to HtempWhen y is updatedfinalAnd taking the expanded area as the clipping area; if H is determined, the process is performedavailableIs less than Htemp–HcoreIf the number of the residual pixels of the picture is not enough to fill the required number of pixels, the clipping fails, and the calculation is finished;
or, if the initial height H is determinedtempIs less thanHeight H of core area of the original picturecoreHowever, in the embodiment of the present application, it is generally necessary to ensure that the core region of the original picture is completely visible when performing picture cropping, and therefore, the height of the core region may be maintained instead, that is:
calculating the height H of the clipping area as the height of the core area of the original picturecoreWhen the target picture is matched with the picture Ratio of the target picturetargetInitial width W oftemp(ii) a And if the initial width W is determinedtempIs larger than the width W of the core area of the original picturecoreIt means that the pixels need to be laterally extended on the basis of the core area of the original picture, and thus, the laterally extendable pixel width W of the original picture can be calculatedavailable=Woriginal–WtempWherein, the WoriginalIs the width of the original picture; and determining said WavailableNot less than Wtemp–WcoreThen, the width W of the pixel needing to be filled currently is determinedneeded=Wtemp–WcoreAnd according to said WneededExpanding pixels equally to two sides of a transverse axis of a core region of the original picture until determining that no usable pixel exists on any one side of the two sides of the transverse axis of the core region of the original picture, and continuing to expand the pixels to the other side of the two sides of the transverse axis until determining that the width of the expanded region is equal to WtempWhen x is updatedfinalAnd taking the expanded area as the clipping area; if W is determined, W is determinedavailableIs less than Wtemp–WcoreIf the number of the residual pixels of the picture is not enough to fill the required number of pixels, the clipping fails, and the calculation is finished;
or, if the initial height H is determinedtempHeight H equal to core area of the original picturecoreTaking the core area of the original picture as the pictureAnd cutting the area.
Thus, a corresponding clipping region which contains the core region of the original picture and has the same picture proportion as the target picture can be obtained.
Further, it should be noted that, in the embodiment of the present application, before receiving a picture acquisition request initiated by a first terminal for an original picture carrying information of a set core area, the method may further include the following steps:
receiving an initial original picture (namely, an initial picture without any core area information) which is uploaded by a second terminal and corresponds to the original picture, and generating adaptable proportion range information of the set core area information; the second terminal and the first terminal can be the same terminal or different terminals; the adaptable proportion range information can refer to information such as adaptable aspect ratio or adaptable aspect ratio;
determining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable proportion range information according to the size information of the initial original picture and the adaptable proportion range information, and indicating the second terminal to upload core area information corresponding to the initial original picture and having a corresponding size not larger than that of the available maximum core area;
receiving core area information uploaded by the second terminal according to the indication, and taking the core area information uploaded by the second terminal as the core area information of the initial original picture corresponding to the adaptable proportion range information;
and writing the core area information of the initial original picture, which corresponds to the adaptable proportion range information, into a copy file of the initial original picture to obtain an original picture which corresponds to the initial original picture and carries the set core area information.
That is to say, in the embodiment of the present application, before receiving a picture acquisition request initiated by a first terminal for an original picture carrying set core area information, the server may receive an initial original picture corresponding to the original picture and uploaded by a second terminal, and adaptable proportion range information used for generating the set core area information, and determine, based on size information of the initial original picture and the adaptable proportion range information, core area information of the initial original picture corresponding to the adaptable proportion range information in an interactive manner with the second terminal, and write the core area information of the initial original picture corresponding to the adaptable proportion range information into a copy file of the initial original picture, to obtain a picture corresponding to the initial original picture, And the original picture carrying the set core region information enables a material picture with any size and including the core region information in the adaptable proportion range to be obtained subsequently based on the set core region information determined according to the adaptable proportion range information, so that the difficulty of picture material adaptation in multi-size scene delivery can be greatly reduced on the basis of ensuring that the core region information of the original picture is not mistakenly cut and further improving the accuracy of picture adaptation.
Further, it should be noted that, for any initial original picture, the server may receive multiple sets of adaptable proportion range information corresponding to the initial original picture, which is uploaded by the second terminal, so that multiple original pictures carrying different core region information may be generated according to the multiple sets of adaptable proportion range information, which is not described in detail in this embodiment of the present application.
Further, determining an available maximum core area corresponding to the initial original picture according to the size information of the initial original picture and the adaptable scale range information may include:
determining a minimum Ratio in the adaptable Ratio range informationminAnd maximum Ratiomax
Calculating and maintaining the minimum Ratio according to the size information of the initial original pictureminDesired maximum width WminMaintaining the minimum RatiominDesired maximum height HminAnd maintaining the maximum RatiomaxDesired maximum width WmaxMaintaining the maximum RatiomaxDesired maximum height Hmax
According to the calculated maintaining minimum RatiominDesired maximum width WminMaximum height HminAnd maintaining the maximum RatiomaxDesired maximum width WmaxMaximum height HmaxDetermining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable scale range information using the following formula:
Wfinal=Min(Wmin,Wmax),Hfinal=Min(Hmin,Hmax);
wherein, WfinalIs the width of the largest available core area, HfinalIs the height of the largest core area available.
Optionally, the minimum Ratio is calculated and maintained according to the size information of the initial original pictureminDesired maximum width WminMaintaining the minimum RatiominDesired maximum height HminThe method comprises the following steps:
according to the width p _ w of the initial original picture, under the condition that the picture width is kept as the width p _ w of the initial original picture, the minimum proportion Ratio is maintainedminA required first height, and taking the width p _ w of the initial original picture as a minimum Ratio when the first height is determined not to be larger than the height p _ h of the initial original pictureminDesired maximum width WminTaking the first height as a maintenance minimum ratioExample RatiominDesired maximum height HminTo obtain Wmin=p_w,Hmin=p_w/Ratiomin(ii) a Or, when it is determined that the first height is greater than the height p _ h of the initial original picture, maintaining the minimum Ratio when the picture height is calculated to be the height p _ h of the initial original pictureminA first width required and used for maintaining a minimum RatiominDesired maximum width WminTaking the height p _ h of the initial original picture as the Ratio for maintaining the minimum RatiominDesired maximum height HminTo obtain Wmin=p_h*RatiominAnd, Hmin=p_h。
Similarly, according to the size information of the initial original picture, calculating and maintaining the maximum RatiomaxDesired maximum width WmaxMaintaining the maximum RatiomaxDesired maximum height HmaxThe method comprises the following steps:
according to the width p _ w of the initial original picture, under the condition that the picture width is kept as the width p _ w of the initial original picture, the maximum Ratio is maintainedmaxA required second height, and taking the width p _ w of the initial original picture as the maximum Ratio maintained when the second height is determined not to be larger than the height p _ h of the initial original picturemaxDesired maximum width WmaxTaking the second height as the Ratio for maintaining the maximum RatiomaxDesired maximum height HmaxTo obtain Wmax=p_w,Hmin=p_w/Ratiomax(ii) a Or, when it is determined that the second height is greater than the height p _ h of the initial original picture, maintaining the maximum Ratio when the picture height is calculated to be the height p _ h of the initial original picturemaxA required second width, and taking the second width as a value for maintaining the maximum RatiomaxDesired maximum width WmaxTaking the height p _ h of the initial original picture as the Ratio for maintaining the maximum RatiomaxDesired maximum height HmaxTo obtain Wmax=p_h*RatiomaxAnd, Hmax=p_h。
Further, in the embodiment of the present application, after writing the core area information of the initial original picture corresponding to the adaptable ratio range information into the initial original picture to obtain an original picture corresponding to the initial original picture and carrying the set core area information, the method may further include:
uploading the original picture carrying the set core area information to a corresponding FS (File System); and returning the address of the original picture carrying the set core area information to the front end of the server for displaying so that each first terminal can initiate a corresponding picture acquisition request according to the address information of the original picture.
Further, it should be noted that, in the FS, the original picture carrying the set core area information may be named and stored in a manner of "address of original picture" + "adaptable proportional range information corresponding to" and the like, so as to facilitate user search, which is not described in detail herein.
Step 103: and zooming the cut picture according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the size same as that of the target picture, and returning the result picture to the first terminal.
Specifically, the scaling ratio R may be calculated according to the size information (e.g., width) of the target picture and the size information (e.g., width) of the cropped picture, for example, the scaling ratio R is calculated as WTarget picture/WCutting picture(ii) a And zooming the cut picture according to the zooming proportion R to obtain a result picture with the same size as the target picture. It should be noted that, since the picture ratio of the target picture is the same as the picture ratio of the cropped picture, the size and the picture ratio of the final resulting picture are the same as those of the target pictureThe sizes and the proportions of the pictures are the same, and details thereof are not described in the embodiments of the present application.
According to the first embodiment of the application, an original picture carrying set core area information can be cut according to size information of a target picture, a cut picture which comprises a core area of the original picture and has the same picture proportion as the target picture is obtained, the cut picture is zoomed according to the size information of the target picture and the size information of the cut picture, and result pictures which comprise the core area of the original picture and have the same size, the same picture proportion as the size and the same picture proportion of the target picture are obtained, so that the difficulty of picture material adaptation during multi-size scene launching can be greatly reduced on the basis of ensuring that the core area of the original picture is not cut by mistake and further improving the accuracy of picture adaptation.
Example two:
a second embodiment of the present application provides a picture processing method, which is a detailed description of the picture processing method in the first embodiment of the present application, and as shown in fig. 2, the picture processing method may include the following steps:
step 201: the core area of the original picture is marked.
Specifically, in order to ensure that the core content of the initial original picture uploaded by the user can be completely displayed in the final result picture, the user needs to mark the core area of the initial original picture on the corresponding server page.
Optionally, in this step 201, the user may upload an initial original picture first, and specify an adaptation ratio range corresponding to the initial original picture. Then, the server may upload the initial original picture to a corresponding file system, and return the obtained picture address (e.g., picture URL, i.e., picture link) to the front-end page for presentation. Then, the server can determine the maximum core area selectable by the user according to the size of the initial original picture and the corresponding adaptation ratio range, and ask the user to submit core area data not larger than the size corresponding to the maximum core area.
Wherein, assuming that the width of the initial original picture is p _ w, the height is p _ h, and the corresponding adaptation ratio range is w1: h 1-w 2: h2, the maximum core area can be calculated by the following method:
determining a minimum Ratio in the adaptation Ratio rangeminAnd maximum Ratiomax
Maintaining the minimum Ratio when calculating the width of the retained picture as p _ wminA desired first height; if the first height is<If p _ h, the Ratio p _ w is taken as the minimum RatiominDesired maximum width WminThe first height is used as the Ratio for maintaining the minimum RatiominDesired maximum height HminTo obtain Wmin=p_w,Hmin=p_w/Ratiomin
If the first height > p _ h, it means that the initial original picture cannot guarantee the minimum ratio without keeping the width unchanged anyway, and thus can instead maintain the height, which can be obtained:
Wmin=p_h*Ratiominand, Hmin=p_h;
By analogy, the maximum Ratio can be maintainedmaxDesired maximum height HmaxAnd a maximum width Wmax(ii) a Further, the size information of the maximum core area available to the user can be obtained, that is:
Hfinal=Min(Hmin,Hmax);
Wfinal=Min(Wmin,Wmax)。
step 202: and saving the core area of the initial original picture.
Optionally, after the user submits the corresponding core area data according to the maximum core area obtained in step 201, the core area data is sent to the server background. Then, the server may request the initial original picture from the corresponding file system again, temporarily store the acquired copy file of the initial original picture in the memory, then write the core region information into the copy file of the initial original picture (e.g., in the Exif data of the copy file), obtain a copy file corresponding to the initial original picture and carrying corresponding core region information (where the copy file carrying corresponding core region information is the original picture carrying corresponding core region information in the present application), upload the copy picture carrying corresponding core region information to the corresponding file system again, and return the picture address of the copy picture to the front end of the server for presentation.
Step 203: and providing a picture cropping service.
Specifically, after knowing an address, such as a URL, of an original picture carrying core region information, a user can obtain, through the HTTP API, picture materials of any size within an adaptation ratio range corresponding to the original picture.
Optionally, the user may initiate a picture retrieval request to access the material through the HTTP API as follows:
http:// < service address >/< original picture address >. jpg _ [ width ] x [ height ]. jpg; the width and height in the sentence respectively refer to the size information such as the width and height of the target picture required by the user.
Further, after receiving a picture acquisition request initiated by a user, the server can firstly search whether a target picture required by the user is cached in the file system, and if so, the server can directly return the target picture to accelerate the processing speed; when it is determined that a picture which contains the core region of the original picture and has the same size and picture proportion as those of the target picture is cached in the file system, the target picture can be considered to be cached in the file system;
if not, the original picture is cut according to the cutting algorithm provided by the application to obtain a cut picture which comprises a core area of the original picture and has the same picture proportion as that of the target picture, the cut picture is zoomed according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the same size as that of the target picture, and the result picture is returned to a corresponding user.
The clipping algorithm adopts a mode of expanding pixels to the periphery based on a core area of an original picture. The specific steps can include:
obtaining size information of the target picture, e.g. width W of the target picturetargetHeight HtargetThereby calculating the picture Ratio of the target picturetarget
Obtaining size information of original picture, e.g. width W of original pictureorignalHeight Horignal
Obtaining core area information of an original picture, including initial coordinate point information (x) of the core areacore,ycore) Width W of core regioncoreHeight HcoreEtc.;
setting a cutting target as follows:
ratio is met when calculating the width of the hold core regiontargetInitial height H oftemp
If H istemp>HcoreThen it indicates that it needs to be in the core area of the original pictureThen, the remaining number of pixels H of the current picture available for expansion can be calculatedavailable=Horiginal–Htemp
If H isavailable<Horiginal–HtempIf the number of the residual pixels of the picture is not enough to fill the required number of pixels, the clipping fails, and the calculation is finished;
if H isavailable>=Horiginal–HtempThen, the number of pixels currently required to be filled is obtained as Hneeded=Htemp–HcoreThen, expanding the pixels to two sides of the y axis of the core area in equal quantity until one side of the core area has no available pixel, continuing to expand the pixels to the other side, and updating y simultaneouslyfinalUntil the zone height equals HtempAt this time, a cropping area with the same picture proportion as that of the target picture can be obtained, and the cropping area completely contains the core area of the original picture;
if H istemp<HcoreHowever, in the embodiment of the present application, it is generally necessary to ensure that the core region of the original picture is completely visible when performing picture cropping, and therefore, the height of the core region may be maintained instead, that is: calculating a coincidence RatiotargetInitial width W oftempAcquiring a cutting area by adopting an algorithm similar to that of the previous step;
if H istemp=HcoreThen the picture scale of the target picture and the picture scale of the core area are exactly equal, so the core area of the original picture can be directly used as the cropping area.
Through the steps, a corresponding cutting area which contains the core area of the original picture and has the same picture proportion as the picture proportion of the target picture can be obtained, and the picture is cut by using the cutting area, so that a cut picture which contains the core area of the original picture and has the same picture proportion as the picture proportion of the target picture can be obtained.
It should be noted that the operations such as marking and cutting the core area described in the embodiment of the present application may be implemented based on a Web application built according to node.
Example three:
based on the same inventive concept, a third embodiment of the present application provides a picture processing method using a first terminal as an execution subject, as shown in fig. 3, which is a schematic flow diagram of the picture processing method in the third embodiment of the present application, and the method may include the following steps:
step 301: the method comprises the steps that a first terminal sends a picture obtaining request aiming at an original picture carrying set core area information to a server, wherein the picture obtaining request carries size information of a target picture required by the first terminal.
Specifically, similar to the related description in step 101, the picture obtaining request may be initiated by the first terminal through an HTTP API; in addition, the picture obtaining request may also be initiated by the first terminal based on address information of the original picture, such as a URL of the original picture, which is not described in detail in this embodiment of the application.
Step 302: receiving a result picture returned by the server according to the picture acquisition request, and taking the result picture as a required target picture; and the result picture is a picture which contains the core area of the original picture and is obtained by the server according to the size information of the target picture, and the size and the picture proportion of the core area are respectively the same as those of the target picture.
That is to say, in the embodiment of the present application, the result picture returned by the server to the first terminal is a picture including the core region of the original picture and having the same size and picture proportion as those of the target picture, so that the difficulty of adapting the picture material when the multi-size scene is launched is greatly reduced on the basis of ensuring that the core region of the original picture is not mistakenly cropped and further improving the accuracy of adapting the picture.
Further, before initiating the picture acquisition request to the server, the method may further include the steps of:
uploading an initial original picture corresponding to the original picture to the server, and generating adaptable proportion range information of the set core area information;
receiving indication information which is issued by the server and used for indicating the first terminal to upload the core area information;
according to indication information which is sent by the server and used for indicating the first terminal to upload the core area information, uploading the core area information which corresponds to the initial original picture and has a corresponding size not larger than the size of the available maximum core area of the initial original picture corresponding to the adaptable proportion range information;
wherein an available maximum core area of the initial original picture corresponding to the adaptable scale range information is determined by the server according to the size information of the initial original picture and the adaptable scale range information.
That is to say, before initiating the picture acquisition request to the server, the first terminal may further perform operations of uploading the initial original picture to the server, specifying an adaptable proportion range for the uploaded initial original picture, uploading corresponding core region information to the server, and the like, which is not described in detail in this embodiment of the present application.
Example four:
based on the same inventive concept, a fourth embodiment of the present application provides a server, and specific implementation of the server may refer to related description in the first embodiment of the method, and repeated details are not repeated, as shown in fig. 4, the server may mainly include:
a receiving unit 41, configured to receive an image obtaining request for an original image carrying information of a set core area, where the image obtaining request carries size information of a target image required by a first terminal, where the image obtaining request is initiated by the first terminal; optionally, the receiving unit 41 may be specifically configured to receive a picture obtaining request for an original picture, which is initiated by the first terminal through an HTTP API or the like;
a cropping unit 42, configured to crop the original picture according to the size information of the target picture, so as to obtain a cropped picture that includes a core region of the original picture and has a picture proportion that is the same as that of the target picture;
a scaling unit 43, configured to scale the cropped picture according to the size information of the target picture and the size information of the cropped picture, so as to obtain a result picture with the same size as the target picture;
a sending unit 44, configured to return the result picture to the first terminal.
Further, the server may further include a preprocessing unit 45:
the preprocessing unit 45 is configured to receive an initial original picture corresponding to an original picture uploaded by a second terminal before receiving a picture acquisition request initiated by a first terminal for the original picture carrying set core region information, and generate adaptable proportion range information of the set core region information; determining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable proportion range information according to the size information of the initial original picture and the adaptable proportion range information, and indicating the second terminal to upload core area information corresponding to the initial original picture and having a corresponding size not larger than that of the available maximum core area; receiving core area information uploaded by the second terminal according to the indication, and taking the core area information uploaded by the second terminal as the core area information of the initial original picture corresponding to the adaptable proportion range information; writing the core area information of the initial original picture, which corresponds to the adaptable proportion range information, into a copy file of the initial original picture to obtain an original picture which corresponds to the initial original picture and carries the set core area information; the second terminal and the first terminal are the same terminal or different terminals.
Optionally, the preprocessing unit 45 is specifically configured to determine a minimum Ratio in the adaptable Ratio range informationminAnd maximum RatiomaxAnd calculating and maintaining the minimum Ratio according to the size information of the initial original pictureminDesired maximum width WminMaintaining the minimum RatiominDesired maximum height HminAnd maintaining the maximum RatiomaxDesired maximum width WmaxMaintaining the maximum RatiomaxDesired maximum height Hmax(ii) a And determining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable scale range information according to the following formula:
Wfinal=Min(Wmin,Wmax),Hfinal=Min(Hmin,Hmax);
wherein, WfinalIs the width of the largest available core area, HfinalIs the height of the largest core area available.
Further, the preprocessing unit 45 is specifically configured to calculate, according to the width p _ w of the initial original picture, a first height required to maintain a minimum ratio min when the picture width is kept as the width p _ w of the initial original picture, and when it is determined that the first height is not greater than the height p _ h of the initial original picture, take the width p _ w of the initial original picture as a maximum width Wmin required to maintain the minimum ratio min, and take the first height as a maximum height Hmin required to maintain the minimum ratio min; or when the first height is determined to be greater than the height p _ h of the initial original picture, calculating a first width required for maintaining a minimum ratio min under the condition that the picture height is kept as the height p _ h of the initial original picture, taking the first width as a maximum width Wmin required for maintaining the minimum ratio min, and taking the height p _ h of the initial original picture as a maximum height Hmin required for maintaining the minimum ratio min; and the number of the first and second groups,
calculating a second height required for maintaining a maximum ratio (Ratiomax) under the condition that the picture width is kept as the width p _ w of the initial original picture according to the width p _ w of the initial original picture, and when the second height is determined to be not greater than the height p _ h of the initial original picture, taking the width p _ w of the initial original picture as a maximum width (Wmax) required for maintaining the maximum ratio (Ratiomax) and taking the second height as a maximum height (Hmax) required for maintaining the maximum ratio (Ratiomax); or, when it is determined that the second height is greater than the height p _ h of the initial original picture, and when the kept picture height is calculated as the height p _ h of the initial original picture, taking the second width required for maintaining the maximum ratio Ratiomax as the maximum width Wmax required for maintaining the maximum ratio Ratiomax, and taking the height p _ h of the initial original picture as the maximum height Hmax required for maintaining the maximum ratio Ratiomax.
Further, the cropping unit 42 is specifically configured to determine a cropping area according to which the original picture is cropped in a manner of extending pixels to the periphery based on a core area of the original picture, where the cropping area includes the core area of the original picture and a corresponding picture ratio is the same as a picture ratio of the target picture; and according to the clipping area, clipping the original picture to obtain a clipped picture which contains the core area of the original picture and has the same picture proportion as that of the target picture.
The cropping unit 42 is specifically configured to determine a cropping area according to which the original picture is cropped by:
starting coordinate point (x) of core area of the original picturecore,ycore) Set as the starting coordinate point (x) of the cutting areafinal,yfinal);
Calculating the width W of the core area of the original picture when the width of the cutting area iscoreWhen the target picture is matched with the picture Ratio of the target picturetargetInitial height H oftemp
If the initial height H is determinedtempHeight H larger than core area of the original picturecoreThen calculate the vertical scalable pixel height H of the original pictureavailable=Horiginal–HtempWherein, the HoriginalIs the height of the original picture; and determining said HavailableNot less than Htemp–HcoreThen, the height H of the pixel needing to be filled currently is determinedneeded=Htemp–HcoreAnd according to said HneededExpanding pixels equally to two sides of a longitudinal axis of a core region of the original picture until determining that no usable pixel exists on any one side of the two sides of the longitudinal axis of the core region of the original picture, and continuing to expand the pixels to the other side of the two sides of the longitudinal axis until determining that the height of the expanded region is equal to HtempWhen y is updatedfinalAnd taking the expanded area as the clipping area; or,
if the initial height H is determinedtempA height H less than a core area of the original picturecoreThen, thenCalculating the height H of the clipping area as the height of the core area of the original picturecoreWhen the target picture is matched with the picture Ratio of the target picturetargetInitial width W oftemp(ii) a And if the initial width W is determinedtempIs larger than the width W of the core area of the original picturecoreThen calculate the horizontal expandable pixel width W of the original pictureavailable=Woriginal–WtempWherein, the WoriginalIs the width of the original picture; and determining said WavailableNot less than Wtemp–WcoreThen, the width W of the pixel needing to be filled currently is determinedneeded=Wtemp–WcoreAnd according to said WneededExpanding pixels equally to two sides of a transverse axis of a core region of the original picture until determining that no usable pixel exists on any one side of the two sides of the transverse axis of the core region of the original picture, and continuing to expand the pixels to the other side of the two sides of the transverse axis until determining that the width of the expanded region is equal to WtempWhen x is updatedfinalAnd taking the expanded area as the clipping area; or,
if the initial height H is determinedtempHeight H equal to core area of the original picturecoreThen, the core area of the original picture is taken as the clipping area.
Further, based on the same inventive concept, a fourth embodiment of the present application further provides a terminal, and specific implementation of the terminal may refer to related description in the third embodiment of the method, and repeated details are not repeated, as shown in fig. 5, the terminal may mainly include:
a sending unit 51, configured to initiate, to a server, a picture acquisition request for an original picture carrying information of a set core area, where the picture acquisition request carries size information of a target picture required by the terminal;
a receiving unit 52, configured to receive a result picture returned by the server according to the picture obtaining request, and use the result picture as a required target picture; and the result picture is a picture which contains the core area of the original picture and is obtained by the server according to the size information of the target picture, and the size and the picture proportion of the core area are respectively the same as those of the target picture.
Further, the sending unit 51 may be further configured to upload an initial original picture corresponding to the original picture to the server before initiating a picture acquisition request to the server, and be configured to generate adaptable ratio range information of the set core area information;
the receiving unit 52 is further configured to receive indication information, which is sent by the server and used for indicating the terminal to upload the core area information;
correspondingly, the sending unit 51 may be further configured to upload, according to indication information issued by the server and used to indicate the terminal to upload the core area information, core area information that corresponds to the initial original picture and corresponds to a size that is not greater than a size of an available maximum core area of the initial original picture corresponding to the adaptable ratio range information; wherein an available maximum core area of the initial original picture corresponding to the adaptable scale range information is determined by the server according to the size information of the initial original picture and the adaptable scale range information.
Further, based on the same inventive concept, a fourth embodiment of the present application further provides an image processing system, and the specific implementation of the image processing system may refer to the related description in the first embodiment of the method, and repeated parts are not repeated, as shown in fig. 6, the image processing system may mainly include a server 61 and a first terminal 62, where:
the server 61 is configured to receive an image acquisition request for an original image carrying information about a set core area, where the image acquisition request carries size information of a target image required by the first terminal 62, where the image acquisition request is initiated by the first terminal 62; cutting the original picture according to the size information of the target picture to obtain a cut picture which contains a core area of the original picture and has the same picture proportion as that of the target picture; zooming the cut picture according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the size same as that of the target picture, and returning the result picture to the first terminal 62;
the first terminal 62 may be configured to initiate a picture obtaining request for an original picture to the server 61, receive a result picture returned by the server according to the picture obtaining request, and use the result picture as a required target picture.
Further, the image processing system may further include a second terminal 63, where the second terminal 63 and the first terminal 62 are the same terminal or different terminals:
the second terminal 63 is configured to upload an initial original picture corresponding to an original picture carrying set core region information to the server 61 and generate adaptable proportion range information of the set core region information before the server 61 receives a picture acquisition request for the original picture initiated by the first terminal 62; and according to the indication information sent by the server 61 and used for indicating the second terminal 63 to upload the core area information, uploading the core area information which corresponds to the initial original picture and has a corresponding size not larger than the size of the maximum available core area of the initial original picture corresponding to the adaptable proportional range information; wherein the available maximum core area of the initial original picture corresponding to the adaptable scale range information is determined by the server 61 according to the size information of the initial original picture and the adaptable scale range information.
Correspondingly, the server 61 may be further configured to receive an initial original picture corresponding to the original picture uploaded by the second terminal 63, and adapted proportion range information used for generating the set core area information; determining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable proportion range information according to the size information of the initial original picture and the adaptable proportion range information, and instructing the second terminal 63 to upload core area information corresponding to the initial original picture and having a corresponding size not larger than the size of the available maximum core area; receiving core area information uploaded by the second terminal 63 according to the indication, and taking the core area information uploaded by the second terminal 63 as the core area information of the initial original picture corresponding to the adaptable proportion range information; and writing the core area information of the initial original picture, which corresponds to the adaptable proportion range information, into a copy file of the initial original picture to obtain an original picture which corresponds to the initial original picture and carries the set core area information.
It should be noted that, in the embodiment of the present application, the terminal may be an entity device such as a mobile phone and a tablet computer, or may be a software device such as a client terminal disposed in the entity device, which is not described in detail in this embodiment of the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, apparatus (device), or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (20)

1. An image processing method, comprising:
the method comprises the steps that a server receives a picture acquisition request which is initiated by a first terminal and aims at an original picture carrying set core area information, wherein the picture acquisition request carries size information of a target picture required by the first terminal;
according to the size information of the target picture, cutting the original picture to obtain a cut picture which contains a core area of the original picture and has the same picture proportion as that of the target picture;
and zooming the cut picture according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the size same as that of the target picture, and returning the result picture to the first terminal.
2. The method according to claim 1, wherein before receiving a picture acquisition request initiated by the first terminal for an original picture carrying information of a set core area, the method further comprises:
receiving an initial original picture corresponding to the original picture uploaded by a second terminal and adaptable proportion range information used for generating the set core area information;
determining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable proportion range information according to the size information of the initial original picture and the adaptable proportion range information, and indicating the second terminal to upload core area information corresponding to the initial original picture and having a corresponding size not larger than that of the available maximum core area;
receiving core area information uploaded by the second terminal according to the indication, and taking the core area information uploaded by the second terminal as the core area information of the initial original picture corresponding to the adaptable proportion range information;
writing the core area information of the initial original picture, which corresponds to the adaptable proportion range information, into a copy file of the initial original picture to obtain an original picture which corresponds to the initial original picture and carries the set core area information;
the second terminal and the first terminal are the same terminal or different terminals.
3. The picture processing method according to claim 2, wherein determining the available maximum core area corresponding to the initial original picture and corresponding to the adaptable scale range information, based on the size information of the initial original picture and the adaptable scale range information, comprises:
determining a minimum Ratio in the adaptable Ratio range informationminAnd maximum Ratiomax
Calculating and maintaining the minimum Ratio according to the size information of the initial original pictureminDesired maximum width WminMaintaining the minimum RatiominDesired maximum height HminAnd maintaining the maximum RatiomaxDesired maximum width WmaxMaintaining the maximum RatiomaxDesired maximum height Hmax
Determining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable scale range information according to the following formula:
Wfinal=Min(Wmin,Wmax),Hfinal=Min(Hmin,Hmax);
wherein, WfinalIs the width of the largest available core area, HfinalIs the height of the largest core area available.
4. The picture processing method according to claim 3, wherein the maintenance Ratio is calculated based on size information of the initial original pictureminRequired WminMaintaining RatiominRequired HminThe method comprises the following steps:
according to the width p _ w of the initial original picture, under the condition of calculating and keeping the picture width as p _ w, the Ratio is maintainedminA first required height, and taking p _ w as a maintenance Ratio when the first height is determined not to be greater than the height p _ h of the initial original pictureminRequired WminTaking the first height as a maintenance RatiominRequired Hmin(ii) a Or, when the first height is determined to be larger than p _ h, calculating the situation of keeping the picture height to be p _ hUnder the condition of maintaining RatiominA first width required and taking the first width as a maintenance RatiominRequired WminLet p _ h be the sustain RatiominRequired Hmin
Calculating and maintaining Ratio according to the size information of the initial original picturemaxRequired WmaxMaintaining RatiomaxRequired HmaxThe method comprises the following steps:
according to p _ w, when the width of the kept picture is calculated to be p _ w, the Ratio is maintainedmaxA required second height, and taking p _ w as a maintenance Ratio when the second height is determined not to be greater than p _ hmaxRequired WmaxTaking the second height as a maintenance RatiomaxRequired Hmax(ii) a Or when the second height is determined to be larger than p _ h, and the kept picture height is calculated to be p _ h, the Ratio is maintainedmaxA second width required and taking the second width as a maintenance RatiomaxRequired WmaxLet p _ h be the sustain RatiomaxRequired Hmax
5. The picture processing method according to claim 1, wherein the cropping the original picture according to the size information of the target picture to obtain a cropped picture including a core area of the original picture and having a picture ratio equal to a picture ratio of the target picture comprises:
determining a clipping region according to which the original picture is clipped in a mode of expanding pixels to the periphery on the basis of a core region of the original picture, wherein the clipping region comprises the core region of the original picture and the corresponding picture proportion is the same as that of the target picture;
and according to the cutting area, cutting the original picture to obtain a cut picture which comprises a core area of the original picture and has the same picture proportion as that of the target picture.
6. The picture processing method according to claim 5, wherein determining a cropping area according to which the original picture is cropped in a manner of extending pixels to four sides based on a core area of the original picture comprises:
starting coordinate point (x) of core area of the original picturecore,ycore) Set as the starting coordinate point (x) of the cutting areafinal,yfinal);
Calculating the width W of the core area of the original picture when the width of the cutting area iscoreWhen the target picture is matched with the picture Ratio of the target picturetargetInitial height H oftemp
If H is determinedtempHeight H larger than core area of the original picturecoreThen calculate the vertical scalable pixel height H of the original pictureavailable=Horiginal–HtempWherein, the HoriginalIs the height of the original picture; and determining said HavailableNot less than Htemp–HcoreThen, the height H of the pixel needing to be filled currently is determinedneeded=Htemp–HcoreAnd according to said HneededExpanding pixels equally to two sides of a longitudinal axis of a core region of the original picture until determining that no usable pixel exists on any one side of the two sides of the longitudinal axis of the core region of the original picture, and continuing to expand the pixels to the other side of the two sides of the longitudinal axis until determining that the height of the expanded region is equal to HtempWhen y is updatedfinalAnd taking the expanded area as the clipping area; or,
if H is determinedtempIs less than HcoreThen, calculating the height of the cutting area as HcoreWhen it is in accordance with RatiotargetInitial width W oftemp(ii) a And if W is determinedtempGreater than WcoreThen calculate the horizontal expandable pixel width W of the original pictureavailable=Woriginal–WtempWherein, the WoriginalIs the width of the original picture; and areIn determining the WavailableNot less than Wtemp–WcoreThen, the width W of the pixel needing to be filled currently is determinedneeded=Wtemp–WcoreAnd according to said WneededExpanding pixels equally to two sides of a transverse axis of a core region of the original picture until determining that no usable pixel exists on any one side of the two sides of the transverse axis of the core region of the original picture, and continuing to expand the pixels to the other side of the two sides of the transverse axis until determining that the width of the expanded region is equal to WtempWhen x is updatedfinalAnd taking the expanded area as the clipping area; or,
if H is determinedtempIs equal to HcoreThen, the core area of the original picture is taken as the clipping area.
7. The picture processing method according to claim 1, wherein the picture acquisition request is not limited to being initiated by the first terminal through a hypertext transfer protocol application programming interface (HTTP API).
8. An image processing method, comprising:
a first terminal initiates a picture acquisition request aiming at an original picture carrying set core area information to a server, wherein the picture acquisition request carries size information of a target picture required by the first terminal;
receiving a result picture returned by the server according to the picture acquisition request, and taking the result picture as a required target picture; and the result picture is a picture which contains the core area of the original picture and is obtained by the server according to the size information of the target picture, and the size and the picture proportion of the core area are respectively the same as those of the target picture.
9. The picture processing method according to claim 8, wherein before initiating a picture acquisition request to the server, the method further comprises:
uploading an initial original picture corresponding to the original picture to the server, and generating adaptable proportion range information of the set core area information;
receiving indication information which is issued by the server and used for indicating the first terminal to upload the core area information;
according to indication information which is sent by the server and used for indicating the first terminal to upload the core area information, uploading the core area information which corresponds to the initial original picture and has a corresponding size not larger than the size of the available maximum core area of the initial original picture corresponding to the adaptable proportion range information; wherein an available maximum core area of the initial original picture corresponding to the adaptable scale range information is determined by the server according to the size information of the initial original picture and the adaptable scale range information.
10. A server, comprising:
a receiving unit, configured to receive an image acquisition request for an original image carrying information of a set core area, where the image acquisition request carries size information of a target image required by a first terminal, where the image acquisition request is initiated by the first terminal;
the cutting unit is used for cutting the original picture according to the size information of the target picture to obtain a cut picture which contains a core area of the original picture and has the same picture proportion as that of the target picture;
the zooming unit is used for zooming the cut picture according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the size same as that of the target picture;
and the sending unit is used for returning the result picture to the first terminal.
11. The server of claim 10, wherein the server further comprises a preprocessing unit:
the preprocessing unit is used for receiving an initial original picture corresponding to an original picture uploaded by a second terminal and generating adaptable proportion range information of set core area information before receiving a picture acquisition request which is initiated by a first terminal and aims at the original picture carrying the set core area information; determining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable proportion range information according to the size information of the initial original picture and the adaptable proportion range information, and indicating the second terminal to upload core area information corresponding to the initial original picture and having a corresponding size not larger than that of the available maximum core area; receiving core area information uploaded by the second terminal according to the indication, and taking the core area information uploaded by the second terminal as the core area information of the initial original picture corresponding to the adaptable proportion range information; writing the core area information of the initial original picture, which corresponds to the adaptable proportion range information, into a copy file of the initial original picture to obtain an original picture which corresponds to the initial original picture and carries the set core area information;
the second terminal and the first terminal are the same terminal or different terminals.
12. The server according to claim 11,
the preprocessing unit is specifically configured to determine a minimum Ratio in the adaptable Ratio range informationminAnd maximum RatiomaxAnd calculating and maintaining the minimum Ratio according to the size information of the initial original pictureminDesired maximum width WminMaintaining the minimum RatiominDesired maximum height HminAnd maintaining the maximum RatiomaxDesired maximum width WmaxMaintaining the maximum RatiomaxDesired maximum height Hmax(ii) a And determining an available maximum core area corresponding to the initial original picture and corresponding to the adaptable scale range information according to the following formula:
Wfinal=Min(Wmin,Wmax),Hfinal=Min(Hmin,Hmax);
wherein, WfinalIs the width of the largest available core area, HfinalIs the height of the largest core area available.
13. The server according to claim 12,
the determining unit is specifically configured to maintain the Ratio when the width of the retained picture is calculated to be p _ w according to the width p _ w of the initial original pictureminA first required height, and taking p _ w as a maintenance Ratio when the first height is determined not to be greater than the height p _ h of the initial original pictureminRequired WminTaking the first height as a maintenance RatiominRequired Hmin(ii) a Or when the first height is determined to be larger than p _ h and the kept picture height is calculated to be p _ h, maintaining the RatiominA first width required and taking the first width as a maintenance RatiominRequired WminLet p _ h be the sustain RatiominRequired Hmin(ii) a And the number of the first and second groups,
according to p _ w, when the width of the kept picture is calculated to be p _ w, the Ratio is maintainedmaxA required second height, and taking p _ w as a maintenance Ratio when the second height is determined not to be greater than p _ hmaxRequired WmaxTaking the second height as a maintenance RatiomaxRequired Hmax(ii) a Or when the second height is determined to be larger than p _ h, and the kept picture height is calculated to be p _ h, the Ratio is maintainedmaxA second width required and taking the second width as a maintenance RatiomaxRequired WmaxLet p _ h be the sustain RatiomaxRequired Hmax
14. The server according to claim 10,
the clipping unit is specifically configured to determine a clipping region according to which the original picture is clipped in a manner of extending pixels to the periphery based on a core region of the original picture, where the clipping region includes the core region of the original picture and a corresponding picture proportion is the same as a picture proportion of the target picture; and according to the clipping area, clipping the original picture to obtain a clipped picture which contains the core area of the original picture and has the same picture proportion as that of the target picture.
15. The server according to claim 14,
the cropping unit is specifically configured to determine a cropping area according to when the original picture is cropped, in the following manner:
starting coordinate point (x) of core area of the original picturecore,ycore) Set as the starting coordinate point (x) of the cutting areafinal,yfinal);
Calculating the width W of the core area of the original picture when the width of the cutting area iscoreWhen the target picture is matched with the picture Ratio of the target picturetargetInitial height H oftemp
If H is determinedtempHeight H larger than core area of the original picturecoreThen calculate the vertical scalable pixel height H of the original pictureavailable=Horiginal–HtempWherein, the HoriginalIs the height of the original picture; and determining said HavailableNot less than Htemp–HcoreThen, the height H of the pixel needing to be filled currently is determinedneeded=Htemp–HcoreAnd according to said HneededEqually expanding pixels to two sides of a longitudinal axis of a core region of the original pictureContinuing to expand pixels to either side of a longitudinal axis of a core region of the original picture until determining that there are no more available pixels to either side of the longitudinal axis until determining that the height of the expanded region is equal to HtempWhen y is updatedfinalAnd taking the expanded area as the clipping area; or,
if H is determinedtempIs less than HcoreThen, calculating the height of the cutting area as HcoreWhen it is in accordance with RatiotargetInitial width W oftemp(ii) a And if W is determinedtempGreater than WcoreThen calculate the horizontal expandable pixel width W of the original pictureavailable=Woriginal–WtempWherein, the WoriginalIs the width of the original picture; and determining said WavailableNot less than Wtemp–WcoreThen, the width W of the pixel needing to be filled currently is determinedneeded=Wtemp–WcoreAnd according to said WneededExpanding pixels equally to two sides of a transverse axis of a core region of the original picture until determining that no usable pixel exists on any one side of the two sides of the transverse axis of the core region of the original picture, and continuing to expand the pixels to the other side of the two sides of the transverse axis until determining that the width of the expanded region is equal to WtempWhen x is updatedfinalAnd taking the expanded area as the clipping area; or,
if H is determinedtempIs equal to HcoreThen, the core area of the original picture is taken as the clipping area.
16. The server of claim 10, wherein the picture retrieval request is not limited to being initiated by the first terminal through a hypertext transfer protocol application programming interface (HTTP API).
17. A terminal, comprising:
a sending unit, configured to initiate, to a server, a picture acquisition request for an original picture carrying information of a set core area, where the picture acquisition request carries size information of a target picture required by the terminal;
the receiving unit is used for receiving a result picture returned by the server according to the picture acquisition request and taking the result picture as a required target picture; and the result picture is a picture which contains the core area of the original picture and is obtained by the server according to the size information of the target picture, and the size and the picture proportion of the core area are respectively the same as those of the target picture.
18. The terminal of claim 17,
the sending unit is further configured to upload an initial original picture corresponding to the original picture to the server and generate adaptable proportion range information of the set core region information before initiating a picture acquisition request to the server;
the receiving unit is further configured to receive indication information, which is issued by the server and used for indicating the terminal to upload the core area information;
the sending unit is further configured to upload, according to indication information issued by the server and used for indicating the terminal to upload the core region information, core region information which corresponds to the initial original picture and has a corresponding size not greater than a size of an available maximum core region of the initial original picture corresponding to the adaptable proportional range information; wherein an available maximum core area of the initial original picture corresponding to the adaptable scale range information is determined by the server according to the size information of the initial original picture and the adaptable scale range information.
19. A picture processing system, comprising:
the server is used for receiving a picture acquisition request which is initiated by a first terminal and aims at an original picture carrying set core area information, wherein the picture acquisition request carries size information of a target picture required by the first terminal; cutting the original picture according to the size information of the target picture to obtain a cut picture which contains a core area of the original picture and has the same picture proportion as that of the target picture; zooming the cut picture according to the size information of the target picture and the size information of the cut picture to obtain a result picture with the size same as that of the target picture, and returning the result picture to the first terminal;
the first terminal is used for initiating a picture acquisition request aiming at an original picture carrying set core area information to a server, receiving a result picture returned by the server according to the picture acquisition request, and taking the result picture as a required target picture.
20. The picture processing system of claim 19, wherein the picture processing system further comprises:
the second terminal is used for uploading an initial original picture corresponding to the original picture to the server and generating adaptable proportion range information of the set core area information before the server receives a picture acquisition request which is initiated by the first terminal and aims at the original picture carrying the set core area information; and according to indication information which is issued by the server and used for indicating the second terminal to upload the core area information, uploading the core area information which corresponds to the initial original picture and has a corresponding size not larger than the size of the available maximum core area of the initial original picture corresponding to the adaptable proportion range information; wherein an available maximum core area of the initial original picture corresponding to the adaptable scale range information is determined by the server according to the size information of the initial original picture and the adaptable scale range information.
CN201510194908.5A 2015-04-22 2015-04-22 A kind of image processing method and relevant device and system Active CN106157239B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510194908.5A CN106157239B (en) 2015-04-22 2015-04-22 A kind of image processing method and relevant device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510194908.5A CN106157239B (en) 2015-04-22 2015-04-22 A kind of image processing method and relevant device and system

Publications (2)

Publication Number Publication Date
CN106157239A true CN106157239A (en) 2016-11-23
CN106157239B CN106157239B (en) 2019-11-08

Family

ID=57346408

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510194908.5A Active CN106157239B (en) 2015-04-22 2015-04-22 A kind of image processing method and relevant device and system

Country Status (1)

Country Link
CN (1) CN106157239B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107590848A (en) * 2017-09-29 2018-01-16 北京金山安全软件有限公司 Picture generation method and device, electronic equipment and storage medium
CN108052572A (en) * 2017-12-07 2018-05-18 福建中金在线信息科技有限公司 Adaptation method, device, electronic equipment and the computer-readable medium of picture
CN108346171A (en) * 2017-01-25 2018-07-31 阿里巴巴集团控股有限公司 A kind of image processing method, device, equipment and computer storage media
CN108573515A (en) * 2017-03-10 2018-09-25 阿里巴巴集团控股有限公司 A kind of conjunction drawing generating method and device close figure template generation method and device
CN109727257A (en) * 2018-12-28 2019-05-07 北京金山安全软件有限公司 Method, device and terminal for automatically cutting picture
CN110580678A (en) * 2019-09-10 2019-12-17 北京百度网讯科技有限公司 image processing method and device
CN112001842A (en) * 2020-07-16 2020-11-27 北京奇艺世纪科技有限公司 Picture generation method and device, electronic equipment and computer readable storage medium
CN112396669A (en) * 2019-08-13 2021-02-23 阿里巴巴集团控股有限公司 Picture processing method and device and electronic equipment
CN112927241A (en) * 2021-03-08 2021-06-08 携程旅游网络技术(上海)有限公司 Picture capturing and thumbnail generating method, system, equipment and storage medium
WO2021237627A1 (en) * 2020-05-28 2021-12-02 深圳市大疆创新科技有限公司 Image processing method and terminal device
CN114693518A (en) * 2022-02-15 2022-07-01 杭州印鸽科技有限公司 Picture printing-oriented intelligent picture cutting method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050025387A1 (en) * 2003-07-31 2005-02-03 Eastman Kodak Company Method and computer program product for producing an image of a desired aspect ratio
CN101118734A (en) * 2007-07-10 2008-02-06 南京Lg新港显示有限公司 Method and apparatus for regulating proportion of display image in display apparatus
CN103824252A (en) * 2014-02-10 2014-05-28 安徽科大讯飞信息科技股份有限公司 Picture processing method and system
CN103903221A (en) * 2012-12-24 2014-07-02 腾讯科技(深圳)有限公司 Image generation method, image generation device and image generation system
CN104504649A (en) * 2014-12-30 2015-04-08 百度在线网络技术(北京)有限公司 Picture cutting method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050025387A1 (en) * 2003-07-31 2005-02-03 Eastman Kodak Company Method and computer program product for producing an image of a desired aspect ratio
CN101118734A (en) * 2007-07-10 2008-02-06 南京Lg新港显示有限公司 Method and apparatus for regulating proportion of display image in display apparatus
CN103903221A (en) * 2012-12-24 2014-07-02 腾讯科技(深圳)有限公司 Image generation method, image generation device and image generation system
CN103824252A (en) * 2014-02-10 2014-05-28 安徽科大讯飞信息科技股份有限公司 Picture processing method and system
CN104504649A (en) * 2014-12-30 2015-04-08 百度在线网络技术(北京)有限公司 Picture cutting method and device

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108346171A (en) * 2017-01-25 2018-07-31 阿里巴巴集团控股有限公司 A kind of image processing method, device, equipment and computer storage media
CN108346171B (en) * 2017-01-25 2021-12-10 斑马智行网络(香港)有限公司 Image processing method, device, equipment and computer storage medium
CN108573515A (en) * 2017-03-10 2018-09-25 阿里巴巴集团控股有限公司 A kind of conjunction drawing generating method and device close figure template generation method and device
CN107590848A (en) * 2017-09-29 2018-01-16 北京金山安全软件有限公司 Picture generation method and device, electronic equipment and storage medium
CN108052572A (en) * 2017-12-07 2018-05-18 福建中金在线信息科技有限公司 Adaptation method, device, electronic equipment and the computer-readable medium of picture
CN109727257A (en) * 2018-12-28 2019-05-07 北京金山安全软件有限公司 Method, device and terminal for automatically cutting picture
CN112396669A (en) * 2019-08-13 2021-02-23 阿里巴巴集团控股有限公司 Picture processing method and device and electronic equipment
CN110580678A (en) * 2019-09-10 2019-12-17 北京百度网讯科技有限公司 image processing method and device
WO2021237627A1 (en) * 2020-05-28 2021-12-02 深圳市大疆创新科技有限公司 Image processing method and terminal device
CN113841377A (en) * 2020-05-28 2021-12-24 深圳市大疆创新科技有限公司 Image processing method and terminal equipment
CN112001842A (en) * 2020-07-16 2020-11-27 北京奇艺世纪科技有限公司 Picture generation method and device, electronic equipment and computer readable storage medium
CN112927241A (en) * 2021-03-08 2021-06-08 携程旅游网络技术(上海)有限公司 Picture capturing and thumbnail generating method, system, equipment and storage medium
CN114693518A (en) * 2022-02-15 2022-07-01 杭州印鸽科技有限公司 Picture printing-oriented intelligent picture cutting method

Also Published As

Publication number Publication date
CN106157239B (en) 2019-11-08

Similar Documents

Publication Publication Date Title
CN106157239B (en) A kind of image processing method and relevant device and system
EP3907657A1 (en) A digital media frame and method for configuring a field of view of a digital media frame
US10403001B2 (en) Producing three-dimensional representation based on images of an object
CN110933296B (en) Apparatus and method for providing content aware photo filter
EP3279803A1 (en) Picture display method and device
EP3840393A1 (en) Contextual local image recognition dataset
WO2014146561A1 (en) Thumbnail generating method and system
US9754350B2 (en) Systems and methods of automatic image sizing
WO2015172359A1 (en) Object search method and apparatus
EP3108455B1 (en) Transparency determination for overlaying images on an electronic display
WO2020087729A1 (en) Image processing method and apparatus, electronic device and storage medium
CN104836957A (en) Photo shooting processing method and device
CN107092428A (en) A kind of picture amending method and device
CN111833234B (en) Image display method, image processing apparatus, and computer-readable storage medium
CN111414104A (en) Electronic map local display method and device
CN107239473A (en) A kind of exhibiting pictures system of selection and device
CN110598026B (en) Display method and device of picture list and terminal equipment
US10832425B2 (en) Image registration method and apparatus for terminal, and terminal
CN114007056A (en) Method and device for generating three-dimensional panoramic image
CN114782579A (en) Image rendering method and device and storage medium
US20140016914A1 (en) Editing apparatus, editing method, program and storage medium
US20200126517A1 (en) Image adjustment method, apparatus, device and computer readable storage medium
CN112396669A (en) Picture processing method and device and electronic equipment
CN108765524B (en) Animation generation method and device based on panoramic photo
CN111145360A (en) System and method for realizing virtual reality map roaming

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant