diff --git a/src/nvtt/CMakeLists.txt b/src/nvtt/CMakeLists.txt
index ea5cc94..fbe715a 100644
--- a/src/nvtt/CMakeLists.txt
+++ b/src/nvtt/CMakeLists.txt
@@ -88,6 +88,19 @@ TARGET_LINK_LIBRARIES(nvzoom nvcore nvmath nvimage)
INSTALL(TARGETS nvcompress nvdecompress nvddsinfo nvimgdiff nvassemble nvzoom nvtestsuite DESTINATION bin)
+ADD_EXECUTABLE(nv-gnome-thumbnailer tools/thumbnailer.cpp tools/cmdline.h)
+TARGET_LINK_LIBRARIES(nv-gnome-thumbnailer nvcore nvmath nvimage)
+
+INSTALL(TARGETS nvcompress nvdecompress nvddsinfo nvimgdiff nvassemble nvzoom nvtestsuite nv-gnome-thumbnailer DESTINATION bin)
+
+IF(GCONFTOOL2)
+ INSTALL(CODE "MESSAGE(STATUS \"Installing thumbnailer schema\")")
+ #gconftool-2 --get-default-source
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GCONFTOOL2} --get-default-source OUTPUT_VARIABLE GCONF_CONFIG_SOURCE OUTPUT_STRIP_TRAILING_WHITESPACE)")
+ INSTALL(CODE "set(ENV{GCONF_CONFIG_SOURCE} \"\${GCONF_CONFIG_SOURCE}\")")
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GCONFTOOL2} --makefile-install-rule ${CMAKE_CURRENT_BINARY_DIR}/tools/nvtt-thumbnailer.schema)")
+ENDIF(GCONFTOOL2)
+
#include_directories("/usr/include/ffmpeg/")
#ADD_EXECUTABLE(nvmpegenc tools/mpegenc.cpp tools/cmdline.h)
#TARGET_LINK_LIBRARIES(nvmpegenc nvcore nvmath nvimage avcodec z)
diff --git a/src/nvtt/tools/nvtt-thumbnailer.schema.in b/src/nvtt/tools/nvtt-thumbnailer.schema.in
new file mode 100644
index 0000000..fd3f394
--- /dev/null
+++ b/src/nvtt/tools/nvtt-thumbnailer.schema.in
@@ -0,0 +1,26 @@
+
+
+
+/schemas/desktop/gnome/thumbnailers/image@x-dds/enable
+/desktop/gnome/thumbnailers/image@x-dds/enable
+nvtt-thumbnailer
+bool
+true
+
+
+
+
+
+
+/schemas/desktop/gnome/thumbnailers/image@x-dds/command
+/desktop/gnome/thumbnailers/image@x-dds/command
+nvtt-thumbnailer
+string
+@CMAKE_INSTALL_PREFIX@/bin/nv-gnome-thumbnailer -s %s %i %o
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/nvtt/tools/thumbnailer.cpp b/src/nvtt/tools/thumbnailer.cpp
new file mode 100644
index 0000000..4ad3224
--- /dev/null
+++ b/src/nvtt/tools/thumbnailer.cpp
@@ -0,0 +1,158 @@
+// Copyright NVIDIA Corporation 2007 -- Ignacio Castano
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+
+#include "cmdline.h"
+
+static bool loadImage(nv::Image & image, const char * fileName)
+{
+ if (nv::strCaseCmp(nv::Path::extension(fileName), ".dds") == 0)
+ {
+ nv::DirectDrawSurface dds(fileName);
+ if (!dds.isValid())
+ {
+ fprintf(stderr, "The file '%s' is not a valid DDS file.\n", fileName);
+ return false;
+ }
+
+ dds.mipmap(&image, 0, 0); // get first image
+ }
+ else
+ {
+ // Regular image.
+ if (!image.load(fileName))
+ {
+ fprintf(stderr, "The file '%s' is not a supported image type.\n", fileName);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
+int main(int argc, char *argv[])
+{
+ //MyAssertHandler assertHandler;
+ MyMessageHandler messageHandler;
+
+ float gamma = 2.2f;
+ nv::Path input;
+ nv::Path output;
+ int size = 128;
+
+ // Parse arguments.
+ for (int i = 1; i < argc; i++)
+ {
+ // Input options.
+ if (strcmp("-s", argv[i]) == 0)
+ {
+ if (i+1 < argc && argv[i+1][0] != '-') {
+ size = (int)atoi(argv[i+1]);
+ i++;
+ }
+ }
+ else if (argv[i][0] != '-')
+ {
+ input = argv[i];
+
+ if (i+1 < argc && argv[i+1][0] != '-') {
+ output = argv[i+1];
+ }
+ else
+ {
+ fprintf(stderr, "No output filename.\n");
+ return 1;
+ }
+
+ break;
+ }
+ }
+
+ if (input.isNull() || output.isNull())
+ {
+ printf("NVIDIA Texture Tools - Copyright NVIDIA Corporation 2007\n\n");
+
+ printf("usage: nv-gnome-thumbnailer [options] input output\n\n");
+
+ printf("Options:\n");
+ printf(" -s size\tThumbnail size (default = 128)\n");
+
+ return 1;
+ }
+
+ nv::Image image;
+ if (!loadImage(image, input)) return 1;
+
+ nv::ImageIO::PngCommentsMap pngComments;
+ pngComments.add("Thumb::Image::Width", nv::StringBuilder().number (image.width()));
+ pngComments.add("Thumb::Image::Height", nv::StringBuilder().number (image.height()));
+
+ if ((image.width() > size) || (image.height() > size))
+ {
+ nv::FloatImage fimage(&image);
+ fimage.toLinear(0, 3, gamma);
+
+ uint thumbW, thumbH;
+ if (image.width() > image.height())
+ {
+ thumbW = size;
+ thumbH = uint ((float (image.height()) / float (image.width())) * size);
+ }
+ else
+ {
+ thumbW = uint ((float (image.width()) / float (image.height())) * size);
+ thumbH = size;
+ }
+ nv::AutoPtr fresult(fimage.resize(nv::BoxFilter(), thumbW, thumbH, nv::FloatImage::WrapMode_Clamp));
+
+ nv::AutoPtr result(fresult->createImageGammaCorrect(gamma));
+ result->setFormat(nv::Image::Format_ARGB);
+
+ nv::StdOutputStream stream(output);
+ nv::ImageIO::savePNG(stream, result.ptr(), pngComments);
+ }
+ else
+ {
+ nv::StdOutputStream stream(output);
+ nv::ImageIO::savePNG(stream, &image, pngComments);
+ }
+
+ return 0;
+}
+