【问题标题】:Where are the thumbnails stored on Nokia phones for captured images?诺基亚手机上所拍摄图像的缩略图存储在哪里?
【发布时间】:2011-03-02 16:07:09
【问题描述】:

以下链接显示了缩略图存储在相应手机中的目录列表: http://wiki.forum.nokia.com/index.php/Thumbnail_path_for_3rd_edition_devices

但是链接上给出的电话是有限的。这是否意味着,对于其他手机(例如 N86、Expressmusic 等),我无法访问缩略图?我尝试使用链接上给出的所有目录结构,但没有一个适用于上述手机。有人知道吗?

【问题讨论】:

    标签: java thumbnails java-me nokia s60


    【解决方案1】:

    我不知道它是否是您需要的,但您可以从全尺寸 JPEG 文件中获取 嵌入 缩略图。在我的 j2me 应用程序中,我以这种方式显示手机图库。

    private final static int STOP_AT_BYTE = 8192;   //how far to search for thumbnail
    private final static int THUMB_MAX_SIZE = 16284; 
    
    private Image getThumbnailFromStream(InputStream str, long fileSize)
    {
        byte[] tempByteArray = new byte[THUMB_MAX_SIZE]; // how big can a thumb get.
        byte[] bytefileReader = {0}; // lazy byte reader
        byte firstByte,secondByte = 0;
        int currentIndex = 0;
    
        int currByte = 0;
    
        try {
            str.read(bytefileReader);
            firstByte = bytefileReader[0];
            str.read(bytefileReader);
            secondByte = bytefileReader[0];
    
            currByte += 2;
    
            if ((firstByte & 0xFF) == 0xFF && (secondByte & 0xFF) == 0xD8) {    //if this is JPEG
                byte rByte = 0;
                do {
                    while (rByte != -1 && currByte < fileSize) {
                        str.read(bytefileReader);
                        rByte = bytefileReader[0];
                        currByte++;
                    }
    
                    str.read(bytefileReader);
                    rByte = bytefileReader[0];
                    currByte++;
    
                    if (currByte > STOP_AT_BYTE) {
                        return null;
                    }
                } while ((rByte & 0xFF) != 0xD8 && currByte < fileSize); // thumb starts
    
                if (currByte >= fileSize) {
                    return null;
                }
    
                tempByteArray[currentIndex++] = -1;
                tempByteArray[currentIndex++] = rByte;
                rByte = 0;
    
                do {
                    while (rByte != -1){
                        str.read(bytefileReader);
                        rByte = bytefileReader[0];
                        tempByteArray[currentIndex++] = rByte;
                    }
    
                    str.read(bytefileReader);
                    rByte = bytefileReader[0];
                    tempByteArray[currentIndex++] = rByte;
                } while ((rByte & 0xFF) != 0xD9); // thumb ends
    
                tempByteArray[currentIndex++] = -1;
                Image image = Image.createImage(tempByteArray, 0, currentIndex-1);
                tempByteArray = null;
    
                return image;
            }
        } catch (Throwable e) {
            //error
        }
    
        return null;
    }
    

    【讨论】:

    • 您好帕维尔,感谢您的回复。您能否详细说明从全尺寸 JPEG 文件中提取嵌入式缩略图是什么意思?现在,我需要一种方法来找到缩略图的路径或在我的代码中压缩画廊中的全尺寸图像。任何建议将不胜感激。谢谢,Ashish。
    • media.mit.edu/pia/Research/deepview/exif.html。您只需要逐字节读取全尺寸图像,直到找到 0xFFD8 标记。这将是嵌入缩略图的开始。
    • 嗨,帕维尔,非常感谢!顺便说一句,我在新加坡国立大学有一个俄罗斯朋友也叫帕维尔。你让我想起了他!感谢您的代码! :) 另外,在诺基亚手机中,通常会存储两个缩略图,一个小,一个略大。两个缩略图是否都存储在完整大小的 JPEG 文件中?还是有其他方法可以获得较小的缩略图?再次感谢,问候,Ashish。
    • 我不知道 - 你可以拍张照片看看。我认为缩略图的大小取决于设备。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-18
    • 1970-01-01
    相关资源
    最近更新 更多