[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:42:29 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=e0d1aaa

The following commit has been merged in the master branch:
commit e0d1aaa265835dfce46840c820c351c624e305a9
Author: vog <vog at notjusthosting.com>
Date:   Mon Jun 27 16:38:57 2011 +0000

    Added support for native PSD previews (Michael Ulbrich)
---
 src/psdimage.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/src/psdimage.cpp b/src/psdimage.cpp
index 5a39d7a..db41c55 100644
--- a/src/psdimage.cpp
+++ b/src/psdimage.cpp
@@ -296,6 +296,53 @@ namespace Exiv2 {
                 break;
             }
 
+            // - PS 4.0 preview data is fetched from ThumbnailResource
+            // - PS >= 5.0 preview data is fetched from ThumbnailResource2
+            case kPhotoshopResourceID_ThumbnailResource:
+            case kPhotoshopResourceID_ThumbnailResource2:
+            {
+                /*
+                  Photoshop thumbnail resource header
+
+                  offset  length    name            description
+                  ======  ========  ====            ===========
+                   0      4 bytes   format          = 1 (kJpegRGB). Also supports kRawRGB (0).
+                   4      4 bytes   width           Width of thumbnail in pixels.
+                   8      4 bytes   height          Height of thumbnail in pixels.
+                  12      4 bytes   widthbytes      Padded row bytes as (width * bitspixel + 31) / 32 * 4.
+                  16      4 bytes   size            Total size as widthbytes * height * planes
+                  20      4 bytes   compressedsize  Size after compression. Used for consistentcy check.
+                  24      2 bytes   bitspixel       = 24. Bits per pixel.
+                  26      2 bytes   planes          = 1. Number of planes.
+                  28      variable  data            JFIF data in RGB format.
+                                                    Note: For resource ID 1033 the data is in BGR format.
+                */
+                byte buf[28];
+                if (io_->read(buf, 28) != 28)
+                {
+                    throw Error(3, "Photoshop");
+                }
+                NativePreview nativePreview;
+                nativePreview.position_ = io_->tell();
+                nativePreview.size_ = getLong(buf + 20, bigEndian);    // compressedsize
+                nativePreview.width_ = getLong(buf + 4, bigEndian);
+                nativePreview.height_ = getLong(buf + 8, bigEndian);
+                const uint32_t format = getLong(buf + 0, bigEndian);
+
+                if (nativePreview.size_ > 0 && nativePreview.position_ >= 0) {
+                    io_->seek(static_cast<long>(nativePreview.size_), BasicIo::cur);
+                    if (io_->error() || io_->eof()) throw Error(14);
+
+                    if (format == 1) {
+                        nativePreview.mimeType_ = "image/jpeg";
+                        nativePreviews_.push_back(nativePreview);
+                    } else {
+                        // unsupported format of native preview
+                    }
+                }
+                break;
+            }
+
             default:
             {
                 break;

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list