Image size intelligent recommendation method and device, computer equipment and storage medium
Through intelligent recommendation methods, the image file size is automatically acquired and optimized, and the problem of inefficient manual operation in the existing technology is solved, efficient image size detection and processing suggestions are realized, and image display effect and system intelligence are improved.
Patent Information
- Application Number
- CN202411012701.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-12-06
AI Technical Summary
In the prior art, image file size acquisition and optimization require manual operation, which is inefficient and lacks intelligent support, especially when processing a large number of image files, errors are prone to occur.
Provide an intelligent recommendation method for image size, by obtaining image files, identifying byte segment data, determining file formats and storing image sizes, analyzing image sizes, and providing optimization display and processing suggestions based on this information, including cropping, Scaling and format conversion.
It realizes intelligent and efficient acquisition of size information in multiple image formats, saves bandwidth and storage resources, improves image display effect and loading speed, supports multi-environment compatibility, and can optimize the recommendation algorithm through user feedback.
Smart Images

Figure CN119088991A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image size intelligent recommendation method, device, computer equipment and storage medium. Background Art
[0002] The size acquisition and optimization of image files play a vital role in many professional fields. They not only affect the visual effect of the image, but are also related to user experience, storage costs, network transmission efficiency, system performance and other aspects.
[0003] In web design and front-end development, the appropriate size can ensure that the image is displayed on the page in accordance with the designer's original intention, while reducing unnecessary loading time and improving user experience. Optimized image files are smaller and can speed up the loading speed of web pages, especially on mobile devices or in poor network conditions. This optimization is particularly important.
[0004] In the fields of graphic design, printing and publishing, image file size acquisition and optimization are also indispensable. High-resolution images can ensure the clarity and details of printed products, while optimization can reduce file size and facilitate storage and transmission. Designers usually set the image size and resolution according to output requirements to achieve the best visual effect and cost-effectiveness.
[0005] In the fields of digital media, advertising and marketing, image file size acquisition and optimization also play an important role. Optimized images can be loaded faster on digital media such as social media and advertising platforms, thereby attracting more user attention. At the same time, the right size can also ensure that the image can maintain good display effects on various devices and screen sizes.
[0006] In the prior art, image file size acquisition and optimization usually require manual operations, which are inefficient and prone to errors. Especially when processing a large number of image files, the existing solutions lack intelligent and automated support. Summary of the invention
[0007] The purpose of the embodiments of the present invention is to provide an image size intelligent recommendation method, device, computer equipment and storage medium to solve the problems of cumbersome manual operation, low efficiency and lack of intelligence in the prior art.
[0008] In order to solve the above technical problems, the present invention provides an image size intelligent recommendation method, which adopts the following technical solution, including:
[0009] Get the image file;
[0010] Identifying byte segment data of the image file;
[0011] Determining the format of the image file according to the byte segment data;
[0012] Determine the byte segment storing the image size according to the format of the image file;
[0013] determining an image size based on the data in the byte segment;
[0014] Based on the image size, optimized display is performed and image processing suggestions are provided.
[0015] Preferably, the step of obtaining the image file specifically includes:
[0016] Select the gallery type according to actual needs;
[0017] Obtaining access rights to the image file by logging in and authenticating;
[0018] Use the query method provided by the gallery provider to query images in the gallery;
[0019] According to the query result, obtain the list information of the images, wherein the list information includes the unique identifier, file name, and URL of each image;
[0020] Download the image file to a local or other storage device based on the unique identifier or file name or URL of the image.
[0021] Preferably, the step of identifying the byte segment data of the image file specifically includes:
[0022] Open and read the image file through a script;
[0023] Performing byte segment positioning on the image file;
[0024] After locating the byte segment, extract the data of the byte segment.
[0025] Preferably, the step of determining the format of the image file according to the byte segment data specifically includes:
[0026] Read the byte segment data of the image file;
[0027] Extracting a characteristic byte sequence from the byte segment data;
[0028] The characteristic byte sequence is compared with the characteristic byte sequence of a known image file format, and if a matching sequence is found, the format of the image file is determined.
[0029] Preferably, the step of determining the byte segment storing the image size according to the format of the image file specifically comprises:
[0030] Locate the byte segment that stores the image size;
[0031] Parse image size information.
[0032] Preferably, the step of determining the image size according to the data in the byte segment specifically comprises:
[0033] Read byte segment data;
[0034] Parse byte segment structure;
[0035] Extract image width, image height, and image bit depth parameters from the byte segment;
[0036] Calculate the image size based on the image width, image height, and image bit depth parameters.
[0037] Preferably, the step of optimizing the display and providing image processing suggestions based on the image size specifically includes:
[0038] Analyze the target display platform, including screen size, resolution, and color space factors;
[0039] Analyze user needs, including user preferences and requirements for image size, clarity, and color;
[0040] Automatically recommend image size based on image content, target display platform, and user needs;
[0041] Based on the recommended image size, users are advised to crop or scale the image;
[0042] It is recommended that users adjust the color of the image based on the image content and display requirements.
[0043] In order to solve the above technical problems, the present invention further provides an image size intelligent recommendation device, which applies the above image size intelligent recommendation method and adopts the following technical solutions, including:
[0044] An acquisition module, used for acquiring image files;
[0045] An identification module, used for identifying byte segment data of the image file;
[0046] A format determination module, used for determining the format of the image file according to the byte segment data;
[0047] A byte segment determination module, used to determine the byte segment storing the image size according to the format of the image file;
[0048] a size determination module, configured to determine the image size based on the data in the byte segment;
[0049] The optimization module is used to optimize the display based on the image size and provide image processing suggestions.
[0050] In order to solve the above technical problems, the present invention also provides a computer device, which adopts the technical solution described below, including a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the above-mentioned image size intelligent recommendation method are implemented.
[0051] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium, which adopts the technical solution described below, and stores computer-readable instructions on the computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned image size intelligent recommendation method are implemented.
[0052] Compared with the prior art, the present invention has the following beneficial effects: it can intelligently and efficiently obtain the size information of various image formats, and provide optimized display and processing suggestions based on the size information; it can perform efficient size detection without downloading the entire image file, thus saving bandwidth and storage resources; it can provide optimization suggestions such as cropping, scaling and format conversion, thus improving image display effects and loading speeds; it can continuously optimize the recommendation algorithm through user feedback, thus improving the intelligence level of the system; it can support running in browsers and Node.js environments, thus expanding the usage scenarios, achieving the goal of multi-environment compatibility, and can be widely used in various image processing and optimization scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the scheme in the present invention, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0054] Figure 1 is a flow chart of an embodiment of the method for intelligently recommending image size according to the present invention;
[0055] Figure 2 is a structural schematic diagram of an embodiment of an image size intelligent recommendation device of the present invention;
[0056] Figure 3 It is a schematic structural diagram of an embodiment of a computer device of the present invention. DETAILED DESCRIPTION
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present invention; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention; the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present invention or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0058] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0059] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.
[0060] It should be noted that the image size intelligent recommendation method provided in the embodiment of the present invention is generally executed by a server / terminal device, and accordingly, the image size intelligent recommendation device is generally arranged in the server / terminal device.
[0061] It should be understood that the number of terminal devices, networks and servers is only illustrative. Depending on the implementation requirements, there can be any number of terminal devices, networks and servers.
[0062] Embodiment 1
[0063] Please refer to Figure 1 , shows a flow chart of an embodiment of the image size intelligent recommendation method of the present invention. The image size intelligent recommendation method comprises the following steps:
[0064] Step S1, obtaining an image file.
[0065] In this embodiment, the electronic device (e.g., server / terminal device) on which the image size intelligent recommendation method runs can receive the image size intelligent recommendation request through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAXX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.
[0066] In this embodiment, step S1, obtaining the image file may further include the following steps:
[0067] S11. Select the gallery type according to actual needs.
[0068] The types of image libraries mainly include image storage services, image databases, etc. Choosing the appropriate image library type according to actual needs is crucial for the smooth progress of subsequent steps.
[0069] You can understand the advantages, disadvantages and applicable scope of various types of image galleries through demand analysis, market research, etc., and make choices based on actual needs.
[0070] S12. Obtain access rights to the image file by logging in and authenticating.
[0071] Different gallery providers may have different login and authentication methods, which need to be operated according to the actual situation.
[0072] For example, you can log in by entering your username, password and other information according to the requirements of the gallery provider; if necessary, you will also need to perform secondary authentication, such as a mobile phone verification code, email verification, etc.
[0073] Through step S12, it can be ensured that the user has legal access rights, and the image files in the gallery are protected from being illegally obtained and used.
[0074] S13. Use the query method provided by the gallery provider to query images in the gallery.
[0075] After successful login and authentication, you can use the API or other query methods provided by the gallery provider to query images in the gallery according to the query conditions. The query conditions can include gallery name, tag, date range, etc.
[0076] For example, you can call the API interface provided by the gallery provider, pass in the corresponding query parameters (such as gallery name, tags, etc.), and obtain the query results. You can also perform query operations through the Web interface provided by the gallery provider.
[0077] Through step S13, the required image file can be quickly located, thereby improving acquisition efficiency.
[0078] S14. According to the query result, obtain the list information of the images, the list information includes the unique identifier, file name, and URL of each image.
[0079] Parse the image list information in the query results and extract key information such as the unique identifier, file name, URL, etc. of each image.
[0080] S15. Download the image file to a local or other storage device according to the unique identifier, file name or URL of the image.
[0081] According to the URL or other identifiers of the image, such as a unique identifier or a file name, the image file can be downloaded to a local or other storage device through an HTTP request or other means. During the download process, attention should be paid to the compatibility of the file format and the control of the download speed.
[0082] For example, you can use an HTTP request library (such as the requests library in Python) to send a GET request to the URL address of the image and save the returned binary data to a local file or other storage device. You can also use a dedicated image download tool to perform the download operation.
[0083] Through step S15, the image file can be transferred from the remote server to a local or other storage device for subsequent processing and analysis.
[0084] Step S2, identifying the byte segment data of the image file.
[0085] In this embodiment, step S2 may further include the following steps:
[0086] S21. Open and read the image file through the script.
[0087] For example, you can use the file I / O function or library in the programming language to open and read the image file. When reading the file, you need to pay attention to the encoding method and format of the file to ensure that the data in the file can be read correctly.
[0088] S22, byte segment positioning of the image file.
[0089] Different image formats have different byte segment structures and identifiers. For example, a JPEG file starts with FFD8 and ends with FFD9, and contains multiple data segments marked by 0xFFE0 to 0xFFEF; while a PNG file uses 89 50 4E 47 0D0A1A0A as the file header. By identifying these identifiers, different byte segments can be located.
[0090] S23. After locating the byte segment, extract the data of the byte segment.
[0091] In specific implementation, how to extract the data of the byte segment depends on the structure and format of the byte segment. For example, for the APPn (n=0-15) segment of a JPEG file, it is necessary to extract the segment identifier, segment length and segment data; and for the IHDR segment of a PNG file, it is necessary to extract key information such as image width, height, color type, etc.
[0092] Step S3, determining the format of the image file according to the byte segment data.
[0093] In this embodiment, step S3 may further include the following steps:
[0094] S31. Read the byte segment data of the image file.
[0095] The byte segment data of the image file can be read through a file reading function (such as ifstream in C++, FileInputStream in Java, etc.) In order to obtain the file header information, only tens to hundreds of bytes at the beginning of the file can be read.
[0096] S32. Extract characteristic byte sequences from the byte segment data.
[0097] Different image file formats have different characteristic byte sequences in their file headers. For example, the file header identifier of a JPEG file is 0xFF, 0xD8 (SOI), and the file end identifier is 0xFF, 0xD9 (EOI); the file header identifier of a PNG file is 8950 4E 47 0D 0A1A0A, etc. Therefore, it is necessary to extract the corresponding characteristic byte sequences according to the specifications of different image file formats.
[0098] S33: Compare the characteristic byte sequence with the characteristic byte sequence of a known image file format. If a matching sequence is found, the format of the image file is determined.
[0099] This is achieved by compiling a database or lookup table containing characteristic byte sequences of all known image file formats. The extracted characteristic byte sequences are compared one by one with the sequences in the database. If a matching sequence is found, the format of the image file can be determined.
[0100] During the specific implementation, some abnormal situations may be encountered, such as file damage, unknown file format, etc. For these situations, special processing is required. For example, a default format can be set as an alternative. When the file format cannot be determined, it is treated as the default format for processing; or an error code can be set. When the file format cannot be determined, the error code is returned and the user is prompted to reselect the file.
[0101] Step S4, determining the byte segment storing the image size according to the format of the image file.
[0102] In this embodiment, step S4 may further include the following steps:
[0103] S41. Locate the byte segment storing the image size.
[0104] Different image file formats have different byte segments for storing image size. The following uses JPEG, PNG, and BMP as examples to illustrate:
[0105] Image size information in JPEG format is usually stored between the SOI (Start of Image) marker and the APPn marker after the file header. The value of the SOI marker is 0xFF 0xD8, indicating the start of the JPEG file. The APPn marker (n is 0 to 15) is used to store various additional information, including parameters such as image size. To obtain the size information of a JPEG image, you need to parse the data between the SOI marker and the APPn marker to find the part containing the image size information.
[0106] The image size information of PNG format is stored in the IHDR (Image Header) block. The IHDR block is a key part of the PNG file, which contains key information such as the width, height, and color depth of the image. To obtain the size information of the PNG image, you need to parse the data in the IHDR block.
[0107] The image size information in BMP format is stored in the bitmap information header. The bitmap information header is located after the BMP file header and contains key information such as the image width, height, color format, etc. To obtain the size information of a BMP image, you need to parse the data in the bitmap information header.
[0108] S42: Analyze image size information.
[0109] Since different image file formats have different data representation methods, it is necessary to parse according to the specific file format. Image size information is usually expressed in pixels, including two parameters: the width and height of the image. After parsing, the image size information can be stored or output in an appropriate manner.
[0110] Step S5, determining the image size according to the data in the byte segment.
[0111] In this embodiment, step S5 may further include the following steps:
[0112] S51. Read byte segment data.
[0113] In the image processing process, image files are usually stored in binary form, which contains multiple byte segments (also called data blocks). Each byte segment carries different information of the image, such as color mode, resolution, bit depth, etc. To determine the image size, you first need to read these byte segment data.
[0114] The process of reading byte segment data involves binary parsing of the image file. Through file parsing, the data in the image file can be read byte by byte and stored in the computer's memory. In this process, the integrity and accuracy of the data need to be ensured so that the subsequent steps can proceed smoothly.
[0115] S52. Parse the byte segment structure.
[0116] Different image file formats (such as JPEG, PNG, BMP, etc.) have different byte segment structures, so corresponding parsing algorithms need to be designed for different file formats.
[0117] When parsing the byte segment structure, we need to pay attention to the byte segments where the information related to the image size is located. These byte segments usually contain key parameters such as image resolution and bit depth, which will directly affect the calculation results of the image size. By parsing these byte segments, we can extract information related to the image size and provide data support for subsequent steps.
[0118] S53, extracting image width, image height and image bit depth parameters from the byte segment.
[0119] In the process of extracting key information, attention should be paid to the accuracy and integrity of the data. Since image files may be damaged or tampered with, the extracted data can be checked and verified to ensure its accuracy and reliability.
[0120] S54, calculating the image size according to the image width, image height and image bit depth parameters.
[0121] By parsing the byte segment data of the JPEG file, it is determined whether it is in JPEG format, and the width and height of the image are obtained according to the start frame (SOF) marker of the JPEG file.
[0122] By parsing the byte segment data of the PNG file, determine whether it is in PNG format, and obtain the width and height of the image based on the IHDR block of the PNG file.
[0123] By parsing the byte segment data of the WebP file, determine whether it is in WebP format, and get the width and height of the image based on the specific byte segments of different types of WebP files (such as VP8 lossy, VP8 lossless, and VP8 extended).
[0124] By parsing the byte segment data of the AVIF file, it is determined whether it is in AVIF format, and the width and height of the image are obtained according to the specific byte segment of the AVIF file.
[0125] The calculation of image size involves multiplying the width and height of the image to get the total number of pixels in the image. At the same time, it is also necessary to consider the impact of factors such as the bit depth of the image on the image size.
[0126] When calculating the image size, you need to pay attention to the accuracy and range of the data. Since the total number of pixels in an image may be very large, you need to use an appropriate data type to store the calculation results to avoid problems such as data overflow or loss of accuracy. At the same time, you also need to consider the impact of factors such as the image compression ratio on the image size to ensure the accuracy and reliability of the calculation results.
[0127] Step S6: Based on the image size, optimize the display and provide image processing suggestions.
[0128] In this embodiment, step S6 may further include the following steps:
[0129] S61. Analyze the target display platform, including screen size, resolution, and color space factors.
[0130] In specific implementation, before step S61, the image may be identified and analyzed to understand the basic attributes and features of the image. For example, a deep learning algorithm may be used to automatically classify and label the image to obtain basic information such as the subject, color, brightness, and contrast of the image.
[0131] The display requirements of the target display platform can be obtained through the Internet, including factors such as screen size, resolution, color space, etc. Through this step, the specific requirements of the target display platform for image size can be understood, thereby ensuring that the recommended image size can achieve the best display effect on this platform.
[0132] S62. Analyze user needs, including user preferences and requirements for image size, clarity, and color.
[0133] By collecting and analyzing users' historical data and feedback, and using big data and machine learning algorithms to predict and infer user behavior, we can derive users' specific needs for image size, for example, their preferences and requirements for image size, clarity, and color.
[0134] S63, automatically recommending an image size based on image content, target display platform, and user needs.
[0135] By considering the image content, the target display platform and user needs, the optimal image size is automatically recommended while maintaining the clarity and details of the image, adapting to the screen size and resolution requirements of the target display platform, and meeting the personalized needs of users.
[0136] After automatically recommending the best image size, the display effect preview is performed, allowing users to preview the image effects at different sizes before actual display. This function can help users better choose the appropriate image size, and also reduce the inconvenience and loss caused by improper selection.
[0137] S64. According to the recommended image size, it is suggested that the user perform cropping or scaling operations on the image.
[0138] In addition to optimizing the display, targeted image processing suggestions can also be provided. These suggestions can help users better process and optimize images to make them more in line with display requirements. For example, based on the recommended image size, users can be advised to crop or scale the image. Cropping can remove unnecessary parts of the image to make the subject more prominent; scaling can adjust the size of the image to adapt to different display platforms. These operations can ensure that the image can maintain the best visual effect when displayed.
[0139] S65. Based on the image content and display requirements, it is recommended that the user adjust the color of the image.
[0140] For example, for images whose colors are too dull or too bright, the system can suggest that users adjust parameters such as brightness, contrast, and color saturation to improve the visual effect of the image.
[0141] For images that need to show details, the system can suggest users to perform detail enhancement operations. For example, using the sharpening tool can highlight the outline and texture of the image; using the noise reduction tool can reduce the noise and noise in the image. These operations can make the image clearer and more delicate when displayed.
[0142] In specific implementation, users can also be advised to convert image formats according to the requirements of the target display platform. For example, for images that need to be displayed online, users can be advised to convert images to formats such as JPEG or PNG; for images that need to be printed, users can be advised to convert images to formats such as TIFF or PSD. These operations can ensure the compatibility and display effects of images on different platforms, such as running in browsers and Node.js environments, expanding the usage scenarios.
[0143] The beneficial effects of implementing this embodiment are as follows: by intelligently and efficiently acquiring the size information of various image formats, and providing optimized display and processing suggestions based on the size information; efficient size detection can be performed without downloading the entire image file, which can save bandwidth and storage resources; optimization suggestions such as cropping, scaling, and format conversion can be provided to improve image display effects and loading speeds; the recommendation algorithm can be continuously optimized through user feedback to improve the intelligence level of the system; it can support running in browsers and Node.js environments, expanding the usage scenarios, achieving the goal of multi-environment compatibility, and can be widely used in various image processing and optimization scenarios.
[0144] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0145] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0146] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0147] Embodiment 2
[0148] Further references Figure 2 , as a response to the above Figure 1 The present invention provides an embodiment of an image size intelligent recommendation device, and the device embodiment is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0149] like Figure 2 As shown, the image size intelligent recommendation device 70 of this embodiment includes: an acquisition module 71, an identification module 72, a format determination module 73, a byte segment determination module 74, a size determination module 75 and an optimization module 76. Among them:
[0150] An acquisition module 71, used for acquiring an image file;
[0151] An identification module 72, used for identifying byte segment data of the image file;
[0152] A format determination module 73, used to determine the format of the image file according to the byte segment data;
[0153] A byte segment determination module 74, used to determine the byte segment storing the image size according to the format of the image file;
[0154] A size determination module 75, for determining the image size according to the data in the byte segment;
[0155] The optimization module 76 is used to optimize the display and provide image processing suggestions based on the image size.
[0156] The beneficial effects of implementing this embodiment are as follows: by intelligently and efficiently acquiring the size information of various image formats, and providing optimized display and processing suggestions based on the size information; efficient size detection can be performed without downloading the entire image file, which can save bandwidth and storage resources; optimization suggestions such as cropping, scaling, and format conversion can be provided to improve image display effects and loading speeds; the recommendation algorithm can be continuously optimized through user feedback to improve the intelligence level of the system; it can support running in browsers and Node.js environments, expanding the usage scenarios, achieving the goal of multi-environment compatibility, and can be widely used in various image processing and optimization scenarios.
[0157] Embodiment 3
[0158] To solve the above technical problems, the embodiment of the present invention also provides a computer device. Figure 3 , Figure 3 This is a basic structural block diagram of the computer device in this embodiment.
[0159] The above-mentioned computer device 8 includes a memory 81, a processor 82, and a network interface 83 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 8 having components of a memory 81, a processor 82, and a network interface 83, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a programmable gate array (FPGA), a digital processor (DSP), an embedded device, etc.
[0160] The computer device may be a desktop computer, a notebook computer, a PDA, a cloud server, etc. The computer device may interact with the user through a keyboard, a mouse, a remote control, a touch pad, or a voice control device.
[0161] The memory 81 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 81 may be an internal storage unit of the computer device 8, such as a hard disk or memory of the computer device 8. In other embodiments, the memory 81 may also be an external storage device of the computer device 8, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 8. Of course, the memory 81 may also include both the internal storage unit of the computer device 8 and its external storage device. In this embodiment, the memory 81 is generally used to store the operating system and various application software installed on the computer device 8, such as computer-readable instructions of the image size intelligent recommendation method, etc. In addition, the memory 81 can also be used to temporarily store various types of data that have been output or are to be output.
[0162] In some embodiments, the processor 82 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 82 is generally used to control the overall operation of the computer device 8. In this embodiment, the processor 82 is used to run the computer-readable instructions stored in the memory 81 or process data, such as running the computer-readable instructions of the image size intelligent recommendation method.
[0163] The network interface 83 may include a wireless network interface or a wired network interface. The network interface 83 is generally used to establish a communication connection between the computer device 8 and other electronic devices.
[0164] The beneficial effects of implementing this embodiment are as follows: by intelligently and efficiently acquiring the size information of various image formats, and providing optimized display and processing suggestions based on the size information; efficient size detection can be performed without downloading the entire image file, which can save bandwidth and storage resources; optimization suggestions such as cropping, scaling, and format conversion can be provided to improve image display effects and loading speeds; the recommendation algorithm can be continuously optimized through user feedback to improve the intelligence level of the system; it can support running in browsers and Node.js environments, expanding the usage scenarios, achieving the goal of multi-environment compatibility, and can be widely used in various image processing and optimization scenarios.
[0165] Embodiment 4
[0166] The present invention also provides another embodiment, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned image size intelligent recommendation method.
[0167] The beneficial effects of implementing this embodiment are as follows: by intelligently and efficiently acquiring the size information of various image formats, and providing optimized display and processing suggestions based on the size information; efficient size detection can be performed without downloading the entire image file, which can save bandwidth and storage resources; optimization suggestions such as cropping, scaling, and format conversion can be provided to improve image display effects and loading speeds; the recommendation algorithm can be continuously optimized through user feedback to improve the intelligence level of the system; it can support running in browsers and Node.js environments, expanding the usage scenarios, achieving the goal of multi-environment compatibility, and can be widely used in various image processing and optimization scenarios.
[0168] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the various embodiment methods of the present invention.
[0169] Obviously, the embodiments described above are only some embodiments of the present invention, rather than all embodiments. The preferred embodiments of the present invention are given in the accompanying drawings, but they do not limit the patent scope of the present invention. The present invention can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive. Although the present invention has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific embodiments, or to perform equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of the present invention, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present invention.
Claims
1. An intelligent image size recommendation method, characterized in that: The steps include: Get the image file; Identifying byte segment data of the image file; Determining the format of the image file according to the byte segment data; Determine the byte segment storing the image size according to the format of the image file; determining an image size based on the data in the byte segment; Based on the image size, optimized display is performed and image processing suggestions are provided.
2. The method for intelligent image size recommendation according to claim 1, characterized in that: The step of obtaining the image file specifically includes: Select the gallery type according to actual needs; Obtaining access rights to the image file by logging in and authenticating; Use the query method provided by the gallery provider to query images in the gallery; According to the query result, obtain the list information of the images, wherein the list information includes the unique identifier, file name, and URL of each image; Download the image file to a local or other storage device based on the unique identifier or file name or URL of the image.
3. The method for intelligent image size recommendation according to claim 1, characterized in that: The step of identifying the byte segment data of the image file specifically comprises: Open and read the image file through a script; Performing byte segment positioning on the image file; After locating the byte segment, extract the data of the byte segment.
4. The method for intelligent image size recommendation according to claim 1, characterized in that: The step of determining the format of the image file according to the byte segment data specifically includes: Read the byte segment data of the image file; Extracting a characteristic byte sequence from the byte segment data; The characteristic byte sequence is compared with the characteristic byte sequence of a known image file format, and if a matching sequence is found, the format of the image file is determined.
5. The method for intelligent image size recommendation according to claim 1, characterized in that: The step of determining the byte segment storing the image size according to the format of the image file specifically comprises: Locate the byte segment that stores the image size; Parse image size information.
6. The method for intelligent image size recommendation according to claim 1, characterized in that: The step of determining the image size according to the data in the byte segment specifically comprises: Read byte segment data; Parse byte segment structure; Extract image width, image height, and image bit depth parameters from the byte segment; Calculate the image size based on the image width, image height, and image bit depth parameters.
7. The method for intelligently recommending image size according to any one of claims 1 to 6, characterized in that: The step of optimizing the display and providing image processing suggestions based on the image size specifically includes: Analyze the target display platform, including screen size, resolution, and color space factors; Analyze user needs, including user preferences and requirements for image size, clarity, and color; Automatically recommend image size based on image content, target display platform, and user needs; Based on the recommended image size, users are advised to crop or scale the image; It is recommended that users adjust the color of the image based on the image content and display requirements.
8. An intelligent image size recommendation device, characterized in that: Applying the method for intelligent image size recommendation according to any one of claims 1 to 7, comprising: An acquisition module, used for acquiring image files; An identification module, used for identifying byte segment data of the image file; A format determination module, used for determining the format of the image file according to the byte segment data; A byte segment determination module, used to determine the byte segment storing the image size according to the format of the image file; a size determination module, configured to determine the image size based on the data in the byte segment; The optimization module is used to optimize the display based on the image size and provide image processing suggestions.
9. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the image size intelligent recommendation method according to any one of claims 1 to 7 when executing the computer-readable instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the image size intelligent recommendation method according to any one of claims 1 to 7 are implemented.
