CN102768755B - Obtain the method and apparatus of the thumbnail of picture - Google Patents

Obtain the method and apparatus of the thumbnail of picture Download PDF

Info

Publication number
CN102768755B
CN102768755B CN201110116984.6A CN201110116984A CN102768755B CN 102768755 B CN102768755 B CN 102768755B CN 201110116984 A CN201110116984 A CN 201110116984A CN 102768755 B CN102768755 B CN 102768755B
Authority
CN
China
Prior art keywords
picture
source picture
described source
thumbnail
gdi
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.)
Active
Application number
CN201110116984.6A
Other languages
Chinese (zh)
Other versions
CN102768755A (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.)
Tencent Technology Shenzhen Co Ltd
Tencent Cloud Computing Beijing Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201110116984.6A priority Critical patent/CN102768755B/en
Publication of CN102768755A publication Critical patent/CN102768755A/en
Application granted granted Critical
Publication of CN102768755B publication Critical patent/CN102768755B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Editing Of Facsimile Originals (AREA)

Abstract

Embodiments provide a kind of method and apparatus obtaining the thumbnail of picture.The method mainly comprises: when source picture belongs to the picture format that GDI+ (Graphics Device Interface of enhancing) can decode, and when the resolution of source picture is less than the numerical value of setting, adopts GDI+ to decode to source picture; The resolution not belonging to picture format that described GDI+ can decode and/or described source picture when source picture is not less than the numerical value of setting, then judge whether described source picture is the JPG file being greater than setting figure place, if so, then GDI+ is utilized to carry out partial decoding of h to described source picture; Otherwise, adopt FreeImage to decode to described source picture.The embodiment of the present invention, by integrating the method for various available generation thumbnail, combines respective advantage, provides complete set solution.Effectively balance the picture format kind of support and compatible, various Consideration such as the generation speed of thumbnail, the thumbnail quality of generation etc.

Description

Obtain the method and apparatus of the thumbnail of picture
Technical field
The present invention relates to picture Processing Technique field, particularly relate to a kind of method and apparatus obtaining the thumbnail of picture.
Background technology
A kind of method obtaining the thumbnail of picture that the windows operating system of Microsoft provides mainly comprises: for the picture in current directory, operating system first reads the " Thumbs.db " file in current directory, should " Thumbs.db " file be a hidden file, represent a thumbnail data storehouse.When operating system does not read the " Thumbs.db " thumbnail of not above-mentioned picture in the thumbnail data storehouse representated by file or " Thumbs.db " file of reading in current directory, then operating system can attempt the EXIF (Exchangeableimagefileformat that obtains in above-mentioned picture, exchangeable image file) information, above-mentioned EXIF information spinner will comprise: the relevant information of the digital photograph inserted in the picture file of the multiple formats such as JPG, may comprise the thumbnail of picture in this relevant information.When not obtaining the thumbnail of picture in the EXIF information of operating system in picture, then operating system can utilize decoding algorithm to carry out complete decoding to picture, then decoded picture is generated to the thumbnail of above-mentioned picture by difference arithmetic.
Realizing in process of the present invention, inventor finds the method for the thumbnail of acquisition picture of the prior art, and at least there are the following problems: carry out complete decoding by decoding algorithm to picture, speed is slow, and the picture format that can support is insufficient, and can not be suitable for the high picture of resolution.
Summary of the invention
The embodiment provides a kind of method and apparatus obtaining the thumbnail of picture, to realize the thumbnail obtaining picture quickly and efficiently.
Obtain a method for the thumbnail of picture, comprising:
Adopt the Graphics Device Interface GDI+ strengthened to decode to source picture, obtain decoded source picture;
Convergent-divergent interpolation is carried out to described decoded source picture, obtains the thumbnail of described source picture.
Obtain a device for the thumbnail of picture, comprising:
Decoding process module, for adopting the Graphics Device Interface GDI+ of enhancing to decode to source picture, obtains decoded source picture;
Interpolation processing module, for carrying out convergent-divergent interpolation to described decoding process module decoded source picture, obtains the thumbnail of described source picture.
The technical scheme provided as can be seen from the embodiment of the invention described above, the embodiment of the present invention, by integrating the method for various available generation thumbnail, combines respective advantage, provides complete set solution.Effectively balance the picture format kind of support and compatible, various Consideration such as the generation speed of thumbnail, the thumbnail quality of generation etc.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme of the embodiment of the present invention, below the accompanying drawing used required in describing embodiment is briefly described, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
A kind of processing flow chart obtaining the method for the thumbnail of picture that Fig. 1 provides for the embodiment of the present invention one;
A kind of concrete structure figure obtaining the device of the thumbnail of picture that Fig. 2 provides for the embodiment of the present invention two.
Embodiment
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
For ease of the understanding to the embodiment of the present invention, be further explained explanation below in conjunction with accompanying drawing for several specific embodiment, and each embodiment does not form the restriction to the embodiment of the present invention.
Embodiment one
A kind for the treatment of scheme obtaining the method for the thumbnail of picture that the embodiment of the present invention provides as shown in Figure 1, comprises following treatment step:
Step 11, obtain the source picture needing to extract thumbnail.Above-mentioned thumbnail carries out the little picture after scale smaller for source picture in computing machine, is generally used for rapid loading or once browses several pictures.In common application scenarios, the Pixel Dimensions of thumbnail is usually at below 150*150.
Step 12, read the file header of above-mentioned source picture, from this file header, obtain the length and width information of above-mentioned source picture, and the length and width information of above-mentioned source picture is preserved.
Step 13, the EXIF information obtained in the picture of above-mentioned source, judge the thumbnail that whether there is above-mentioned source picture in this EXIF information, if so, then performs step 14; Otherwise, perform step 16.
Step 14, from the EXIF information the picture of above-mentioned source, extract the thumbnail of above-mentioned source picture, perform step 15.
Step 15, length and width information according to the source picture of above-mentioned preservation, calculate the Aspect Ratio of above-mentioned source picture, and calculate the Aspect Ratio of the thumbnail of above-mentioned source picture.Judge that whether the Aspect Ratio of the thumbnail of above-mentioned source picture is consistent with the Aspect Ratio of above-mentioned source picture, if so, then obtain the thumbnail of above-mentioned source picture, flow process terminates; Otherwise, perform step 16.
A kind of GDI (Graphics Device Interface that the windows operating system of step 16, Microsoft provides, GraphicsDeviceInterface) major function is the message exchange between responsible system and plotter program, processes the images outputting of all Windows programs.GDI+ (GDI of enhancing) is the succession for former version GDI in WindowsXP and expansion.
The most common image form of above-mentioned GDI+ enclosed inside, the picture formats such as such as BMP, JPEG, GIF, PNG, TIFF.When the resolution of picture is larger, the speed of above-mentioned GDI+ decoding picture is by slow, and the length and width size of usual picture is greater than 1200, then think that the resolution of above-mentioned picture is larger.
Judge the picture format whether above-mentioned source picture belongs to above-mentioned GDI+ and can decode, and resolution less (namely the length and width size of source picture is not more than 1200), if so, then perform step 17; Otherwise, perform step 18.
Step 17, the decoding functions provided by calling GDI+ carry out complete decoding to above-mentioned source picture, and carry out convergent-divergent interpolation to decoded source picture, obtain the thumbnail of above-mentioned source picture, above-mentioned convergent-divergent interpolation comprises the known interpolation method such as arest neighbors, bilinearity.
Flow process terminates.
Step 18, judge that whether above-mentioned source picture is the JPG file being greater than setting figure place, if so, then perform step 19; Otherwise, perform step 20.Above-mentioned setting figure place can be 24.
Step 19, determine that above-mentioned source picture is the picture that resolution is large, long limit is greater than 1200, otherwise adopts GDI+ to decode in above-mentioned steps 17 to above-mentioned source picture.So according to the characteristic of JPG picture, the decoding functions provided by calling GDI+ carries out 1/8th fast decodings to above-mentioned source picture, namely intercepts the length and wide 1/8th of above-mentioned source picture respectively, GDI+ is utilized to decode to the source picture after intercepting.
Convergent-divergent interpolation is carried out to decoded source picture, obtains the thumbnail of above-mentioned source picture.Such as, the resolution of source picture is 2400*1600, and the resolution of 1/8th decoding figure so obtained is exactly 300*200, because thumbnail is less than 150*150, so more above-mentioned 1/8th decoding figure are carried out convergent-divergent interpolation to generate thumbnail.Flow process terminates.
Step 20, FreeImage (development diagram valut) are a picture format encoding and decoding engine storehouses of increasing income, and FreeImage is a lot of very complete to picture format support.The decoding functions provided by calling FreeImage carries out complete decoding to above-mentioned source picture.
Perform step 21.
Step 21, carry out convergent-divergent interpolation to decoded source picture, obtain the thumbnail of above-mentioned source picture, flow process terminates.
Embodiment two
A kind of device obtaining the thumbnail of picture that the embodiment of the present invention also provides, its concrete structure as shown in Figure 2, comprises following module:
Decoding process module 21, for adopting the Graphics Device Interface GDI+ of enhancing to decode to source picture, obtains decoded source picture;
Interpolation processing module 22, for carrying out convergent-divergent interpolation to described decoding process module decoded source picture, obtains the thumbnail of described source picture.
Described device can also comprise:
EXIF message processing module 23, for reading the file header of described source picture, obtaining the length and width information of described source picture, calculating the Aspect Ratio of described source picture according to this length and width information from this file header; When comprising the thumbnail of described source picture in the EXIF information in the picture of described source, then from described EXIF information, extracting the thumbnail of described source picture, calculating the Aspect Ratio of the thumbnail of described source picture; Judge that whether the Aspect Ratio of the thumbnail of described source picture is consistent with the Aspect Ratio of described source picture, if so, then obtain the thumbnail of described source picture; Otherwise, adopt GDI+ to decode to described source picture.
Specifically, described decoding process module 21 can comprise:
First processing module 211, for belonging to the picture format that described GDI+ can decode when described source picture, and when the resolution of described source picture is less than the numerical value of setting, then the decoding functions that calling described GDI+ provides is decoded to described source picture.
Described decoding process module can also comprise:
Second processing module 212, the resolution not belonging to picture format that described GDI+ can decode and/or described source picture when described source picture is not less than the numerical value of setting, then judge whether described source picture is the JPG file being greater than setting figure place, if so, then the decoding functions that calling described GDI+ provides carries out partial decoding of h to described source picture; Otherwise the decoding functions that calling described development diagram valut FreeImage provides is decoded to described source picture.
One of ordinary skill in the art will appreciate that all or part of flow process realized in above-described embodiment method, that the hardware that can carry out instruction relevant by computer program has come, described program can be stored in a computer read/write memory medium, this program, when performing, can comprise the flow process of the embodiment as above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-OnlyMemory, ROM) or random store-memory body (RandomAccessMemory, RAM) etc.
To sum up, the embodiment of the present invention is decoded to source picture by adopting GDI+, then, convergent-divergent interpolation is carried out to decoded source picture, obtain the thumbnail of described source picture, the thumbnail of picture can be obtained rapidly, and the picture format supported is also many.
For the picture with EXIF information, whether the embodiment of the present invention is consistent with the Aspect Ratio of above-mentioned source picture by the Aspect Ratio of the thumbnail judging picture, ensures the correctness of the thumbnail of the picture obtained from EXIF information.
For the picture of those not common format, the picture that resolution is large, the embodiment of the present invention carries out partial decoding of h by calling GDI+ to picture; Or, call FreeImage and picture decoded, ensure effectively to decode to picture.
The embodiment of the present invention is by integrating the method for various available generation thumbnail, combine respective advantage, provide complete set solution, effectively balance the picture format kind of support and compatible, various Consideration such as the generation speed of thumbnail, the thumbnail quality of generation etc.
The above; be only the present invention's preferably embodiment, but protection scope of the present invention is not limited thereto, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; the change that can expect easily or replacement, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claim.

Claims (4)

1. obtain a method for the thumbnail of picture, it is characterized in that, comprising:
Decoding process step: when source picture belongs to the picture format that Graphics Device Interface GDI+ can decode, and when the resolution of described source picture is less than the numerical value of setting, the decoding functions that calling described GDI+ provides carries out complete decoding to described source picture, obtains decoded source picture;
When the resolution that described source picture does not belong to picture format that described GDI+ can decode and/or described source picture is not less than the numerical value of this setting, then judge whether described source picture is the JPG file being greater than setting figure place, if, GDI+ is then utilized to carry out partial decoding of h to described source picture, otherwise, then adopt development diagram valut FreeImage to decode to described source picture, obtain decoded source picture; And
Interpolation processing step: convergent-divergent interpolation is carried out to described decoded source picture, obtains the thumbnail of described source picture.
2. the method for the thumbnail of acquisition picture according to claim 1, is characterized in that, also comprises before described decoding process step:
Read the file header of described source picture, from this file header, obtain the length and width information of described source picture, calculate the Aspect Ratio of described source picture according to this length and width information;
When comprising the thumbnail of described source picture in the exchangeable image file EXIF information in the picture of described source, then from described EXIF information, extracting the thumbnail of described source picture, calculating the Aspect Ratio of the thumbnail of described source picture;
Judge that whether the Aspect Ratio of the thumbnail of described source picture is consistent with the Aspect Ratio of described source picture, if so, then obtain the thumbnail of described source picture; Otherwise, perform described decoding process step.
3. obtain a device for the thumbnail of picture, it is characterized in that, comprising:
First processing module, for belonging to the picture format that Graphics Device Interface GDI+ can decode when source picture, and when the resolution of described source picture is less than the numerical value of setting, the decoding functions that calling described GDI+ provides carries out complete decoding to described source picture, obtains decoded source picture;
Second processing module, when resolution for not belonging to picture format that described GDI+ can decode and/or described source picture when described source picture is not less than the numerical value of this setting, then judge whether described source picture is the JPG file being greater than setting figure place, if, GDI+ is then utilized to carry out partial decoding of h to described source picture, otherwise, then adopt development diagram valut FreeImage to decode to described source picture, obtain decoded source picture; And
Interpolation processing module, for carrying out convergent-divergent interpolation to described first processing module or the second processing module decoded source picture, obtains the thumbnail of described source picture.
4. the device of the thumbnail of acquisition picture according to claim 3, is characterized in that, described device also comprises:
Exchangeable image file EXIF message processing module, for reading the file header of described source picture, obtaining the length and width information of described source picture, calculating the Aspect Ratio of described source picture according to this length and width information from this file header; When comprising the thumbnail of described source picture in the EXIF information in the picture of described source, then from described EXIF information, extracting the thumbnail of described source picture, calculating the Aspect Ratio of the thumbnail of described source picture; Judge that whether the Aspect Ratio of the thumbnail of described source picture is consistent with the Aspect Ratio of described source picture, if so, then obtain the thumbnail of described source picture; Otherwise, perform described first processing module or the second processing module.
CN201110116984.6A 2011-05-06 2011-05-06 Obtain the method and apparatus of the thumbnail of picture Active CN102768755B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110116984.6A CN102768755B (en) 2011-05-06 2011-05-06 Obtain the method and apparatus of the thumbnail of picture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110116984.6A CN102768755B (en) 2011-05-06 2011-05-06 Obtain the method and apparatus of the thumbnail of picture

Publications (2)

Publication Number Publication Date
CN102768755A CN102768755A (en) 2012-11-07
CN102768755B true CN102768755B (en) 2016-04-06

Family

ID=47096148

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110116984.6A Active CN102768755B (en) 2011-05-06 2011-05-06 Obtain the method and apparatus of the thumbnail of picture

Country Status (1)

Country Link
CN (1) CN102768755B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103886624B (en) * 2012-12-24 2017-02-08 三星电子(中国)研发中心 JPEG image thumbnail extracting method
CN104933184A (en) * 2015-06-30 2015-09-23 上海玮舟微电子科技有限公司 Picture output method and device
CN105447820B (en) * 2015-12-22 2018-10-23 厦门美图移动科技有限公司 A kind of image processing method, device and mobile terminal
CN111986282B (en) * 2020-08-21 2024-06-07 上海二三四五网络科技有限公司 Plug-in for opening HEIC format pictures, freeIMage and computer program thereof

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4719375A (en) * 1986-05-09 1988-01-12 The United States Of America As Represented By The United States Department Of Energy High resolution digital delay timer
CN100515035C (en) * 2001-09-10 2009-07-15 株式会社尼康 Digital camera system, image storage apparatus, and digital camera
CN101472163A (en) * 2007-12-25 2009-07-01 百度在线网络技术(北京)有限公司 Method, apparatus and system for transmitting picture file

Also Published As

Publication number Publication date
CN102768755A (en) 2012-11-07

Similar Documents

Publication Publication Date Title
CN106030652B (en) Method, system and composite display controller for providing output surface and computer medium
CN102768755B (en) Obtain the method and apparatus of the thumbnail of picture
US8837770B2 (en) Non-transitory computer readable storage medium, marker creating apparatus, and marker creating method
CN110991310B (en) Portrait detection method, device, electronic equipment and computer readable medium
JP2007082217A (en) Method and device for creating thumbnail of digital image
CN106803959B (en) Video image encoding method, video image decoding method, video image encoding apparatus, video image decoding apparatus, and readable storage medium
CN105791952A (en) Screen shooting method and device for streaming media video data, and electronic device
JP2006050551A (en) Image processing apparatus, image processing method, program and storage medium
CN115022670B (en) Video file storage method, video file restoration device, video file storage equipment and storage medium
CN105681893A (en) Method and device for decoding stream media video data
JP2017211936A (en) Document storage processing system
CN110572713B (en) Transcoding method and processing terminal for adaptive video bandwidth ratio
CN102572207A (en) Color space transformation method suitable for joint photographic experts group (JPEG) image
CN102176205A (en) File format for storage of chain code image sequence and decoding algorithm
CN115225615B (en) Illusion engine pixel streaming method and device
JP2017192080A (en) Image compression device, image decoding device, image compression method, and image compression program
CN111246249A (en) Image encoding method, encoding device, decoding method, decoding device and storage medium
CN1231101A (en) Image mapping device and method, and image generating device and method
CN108876703B (en) Data storage method
CN104517259A (en) Digital watermark insertion method and device in color text files
CN112312043A (en) Optimization method and device for deriving animation video
EP2169616B1 (en) Video scaling techniques
CN111405200A (en) Video shrinking device, method and system and electronic equipment thereof
CN118101971B (en) Decoding data rendering method and device, electronic equipment and storage medium
CN112000400B (en) Animation resource file generation method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20190812

Address after: 518057 Nanshan District science and technology zone, Guangdong, Zhejiang Province, science and technology in the Tencent Building on the 1st floor of the 35 layer

Co-patentee after: Tencent cloud computing (Beijing) limited liability company

Patentee after: Tencent Technology (Shenzhen) Co., Ltd.

Address before: 2 East 403 room, SEG science and technology garden, Futian District, Guangdong, Shenzhen 518028, China

Patentee before: Tencent Technology (Shenzhen) Co., Ltd.