Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#10 Scene number not respected in source filename

open
None
5
2012-09-02
2010-04-21
No

I am trying to use GM to create thumbnails of uploaded files, where the files can be of any type. It works well in general, but for text files (UTF-8 encoded, if that matters), I get more than one resulting thumbnail file. Here's an exhaustive list of the commands/options combinations I've tried just to be sure I'm not doing it entirely wrong:

/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt[0]' -thumbnail '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt' -thumbnail '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert 'uploadedFile.txt[0]' -thumbnail '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert 'uploadedFile.txt' -thumbnail '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt[0]' -thumbnail '300x300>' +profile '*' -adjoin thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt' -thumbnail '300x300>' +profile '*' -adjoin thumbnail.jpg
/usr/local/bin/gm convert -adjoin 'uploadedFile.txt[0]' -thumbnail '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -adjoin 'uploadedFile.txt' -thumbnail '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt[0]' -thumbnail '300x300>' +profile '*' +adjoin thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt' -thumbnail '300x300>' +profile '*' +adjoin thumbnail.jpg
/usr/local/bin/gm convert +adjoin 'uploadedFile.txt[0]' -thumbnail '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert +adjoin 'uploadedFile.txt' -thumbnail '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt[0]' -resize '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt' -resize '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert 'uploadedFile.txt[0]' -resize '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert 'uploadedFile.txt' -resize '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt[0]' -resize '300x300>' +profile '*' -adjoin thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt' -resize '300x300>' +profile '*' -adjoin thumbnail.jpg
/usr/local/bin/gm convert -adjoin 'uploadedFile.txt[0]' -resize '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -adjoin 'uploadedFile.txt' -resize '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt[0]' -resize '300x300>' +profile '*' +adjoin thumbnail.jpg
/usr/local/bin/gm convert -size 300x300 'uploadedFile.txt' -resize '300x300>' +profile '*' +adjoin thumbnail.jpg
/usr/local/bin/gm convert +adjoin 'uploadedFile.txt[0]' -resize '300x300>' +profile '*' thumbnail.jpg
/usr/local/bin/gm convert +adjoin 'uploadedFile.txt' -resize '300x300>' +profile '*' thumbnail.jpg

They all produce the files thumbnail.jpg.0, thumbnail.jpg.1 and thumbnail.jpg.2. These files each contain one third of the contents of the text file, so GM is apparently splitting it into scenes.

ac# ls -l
total 26
-rw-r--r-- 1 www www 219 Apr 20 13:44 metadata.properties
-rw-r--r-- 1 root www 5144 Apr 20 18:50 thumbnail.jpg.0
-rw-r--r-- 1 root www 6424 Apr 20 18:50 thumbnail.jpg.1
-rw-r--r-- 1 root www 4915 Apr 20 18:50 thumbnail.jpg.2
-rw-r--r-- 1 www www 2508 Apr 20 13:44 uploadedFile.txt

What I want is one file, thumbnail.jpg. I would like it to contain a thumbnail/preview of the first scene in the file, if there has to be scenes :) As you can see I tried the adjoin option, thinking it should/might as a plan B make a preview of the entire file (which would be very small and unreadable but OK if nothing else is possible), but it doesn't seem to have any effect.

Using [0] with the source file name works perfectly with multi-pages PDF documents or GIF animations for example, so I thought it would work here too.

Here's some more information:

ac# wc -l uploadedFile.txt
113 uploadedFile.txt

ac# file uploadedFile.txt
uploadedFile.txt: UTF-8 Unicode text

ac# gm version
GraphicsMagick 1.3.12 2010-03-08 Q16 http://www.GraphicsMagick.org/
Copyright (C) 2002-2010 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.

Feature Support:
Thread Safe no
Large Files (> 32 bit) yes
Large Memory (> 32 bit) no
BZIP yes
DPS no
FlashPix yes
FreeType yes
Ghostscript (Library) no
JBIG yes
JPEG-2000 yes
JPEG yes
Little CMS yes
Loadable Modules yes
OpenMP no
PNG yes
TIFF yes
TRIO no
UMEM no
WMF yes
X11 no
XML yes
ZLIB yes

Host type: i386-portbld-freebsd6.3

Configured using the command:
./configure '--without-perl' '--enable-shared' '--enable-static' '--with-ltdl-include=/usr/local/include' '--with-ltdl-lib=/usr/local/lib' '--with-fpx' '--with-dps' '--without-threads' '--disable-openmp' '--without-x' '--with-quantum-depth=16' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=i386-portbld-freebsd6.3' 'build_alias=i386-portbld-freebsd6.3' 'CC=cc' 'CFLAGS=-O2 -fno-strict-aliasing -pipe' 'LDFLAGS=-L/usr/local/lib' 'CPPFLAGS=-I/usr/local/include' 'CXX=c++' 'CXXFLAGS=-O2 -fno-strict-aliasing -pipe'

Final Build Parameters:
CC = cc -std=gnu99
CFLAGS = -O2 -fno-strict-aliasing -pipe -Wall
CPPFLAGS = -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include/libxml2
CXX = c++
CXXFLAGS = -O2 -fno-strict-aliasing -pipe
LDFLAGS = -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib
LIBS = -ljbig -llcms -ltiff -lfreetype -ljasper -ljpeg -lpng -lfpx -lwmflite -lbz2 -lxml2 -lz -lm

I am attaching a test file with some dummy data in it. I have verified that it produces the same problem, but five thumbnail files instead since it is longer than my original file.

Discussion



  • 2010-04-21

    Test case, produces five thumbnail files with GM 1.3.12.

     
    Attachments


  • 2010-07-02

    Hello :) Any chance to have this looked at? I imagine it woudln't be a very complex fix since the missing functionality is there for other file formats. Thanks!

     
  • This bug is still definitely on my list of things to do. I did study the code and did some preparatory work. The functionality needs to be implemented in the reader for every format which might return more than one page and so the level of effort varies.

     
    • labels: 595549 -->