简体   繁体   English

JPG / PNG缩略图

[英]JPG / PNG Thumbnail

So let's say I have a JPEG file of 4mb~ and I don't want to read it all to create a preview. 所以,假设我有一个4mb~的JPEG文件,我不想全部阅读以创建预览。 Is there a way to skip reading some cols/rows? 有没有办法跳过阅读一些cols / rows? I tried for example Irfanview Thumbnails, but that applications read the entire file first, then creates the thumbnail, so I was thinking of doing a custom app to achieve this. 我试过例如Irfanview Thumbnails,但是应用程序首先读取整个文件,然后创建缩略图,所以我想做一个自定义应用程序来实现这一点。

If I don't care about quality or artifacts, is this possible? 如果我不关心质量或文物,这可能吗? The image resides in local / private network filesystem. 该映像位于本地/专用网络文件系统中。

If the JPEG image has an embedded (EXIF) thumbnail, you can read that much faster than reading the whole file. 如果JPEG图像具有嵌入式(EXIF)缩略图,则读取速度比读取整个文件要快得多。 The thumbnail image is usually less than 24K bytes. 缩略图图像通常小于24K字节。 Typical phones and digital cameras embed a 160x120 image. 典型的手机和数码相机嵌入了160x120的图像。 If this is large enough for your purposes and you're working with photos, then you have a solution. 如果这对于您的目的而言足够大并且您正在处理照片,那么您就有了解决方案。 For the case where you don't have an embedded thumbnail or need one at a higher resolution, you will need to read the entire file contents unless it is stored as a progressive image (as mentioned above). 对于没有嵌入缩略图或需要更高分辨率的缩略图的情况,除非将其存储为渐进式图像(如上所述),否则需要读取整个文件内容。 The quickest way to generate a thumbnail is to use only the DC values for each MCU and you will end up with a 1/64th image (1/8th in x and y directions). 生成缩略图的最快方法是仅使用每个MCU的DC值,最终得到1/64图像(x和y方向的1/8)。 This allows you to skip the expensive DCT and color conversion steps for the entire image. 这使您可以跳过整个图像的昂贵的DCT和颜色转换步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM