convert - thumbnail parameters

Questions about the Synology Photo Station can be placed here.

convert - thumbnail parameters

Postby biteaba » Thu Apr 29, 2010 10:33 am

Hi everybody,

yesterday found out that convert does lots of things for a few thumbnails, like resize, quality is too big for a 64x64 thumb, autorotate, unsharp, etc...
So I would ask Synology, can they add a page to PhotoStation page in Management, to activate or deactivate some of these processes that are applied on pictures at reindexing ?

Or at least give us some informations about the options configurable in thumb.conf.

It took me about 1 full day to convert about 250 photos.... Looked into it, and found thumb.conf. Set the quality of pictures (all 4 resized pictures/thumbs) to 50% and after about 8 hours I have all my pics
indexed !

So, can we have some options for these thumbnails ?

Thanks.

Owner of DS410j. Had LLC and alignment problems too with a WD2000EARS :D
biteaba
I'm New!
I'm New!
 
Posts: 1
Joined: Thu Apr 29, 2010 10:25 am

Re: convert - thumbnail parameters

Postby benob » Wed Jun 23, 2010 9:42 pm

On the DS110j, indexing pictures takes days (if not weeks). I have found out that the -unsharp option to convert seems to be the culprit. For instance, on my NAS:

Code: Select all
time convert -size 800x800 -unsharp 0.5x0.5+1.25+0.0 picture.jpeg picture-converted.jpeg
real    1m 17.04s
time convert -size 800x800 picture.jpeg picture-converted.jpeg
real    0m 4.88s


picture.jpeg is 4000x3000 pixels. So, I suggest that the Synology guys put an option for slow/fast image indexing. In the mean time, on my DS110j, I wrote a wrapper script that removes the option:

Code: Select all
#!/usr/bin/perl -w
@new_args = ();
$old_arg = "";
for $arg(@ARGV) {
        if($arg eq "-size") { $arg = "-sample"; }
        if($arg ne "-unsharp") {
                if($old_arg ne "-unsharp") {
                        push @new_args, $arg;
                }
        }
        $old_arg = $arg;
}
exec "/lib/hddapp/usr/syno/bin/convert", @new_args;


put it in /usr/syno/bin/convert_nosharpen.sh
chmod and relink to use it (on my system, convert was a link to/lib/hddapp/usr/syno/bin/convert) :

Code: Select all
chmod +x /usr/syno/bin/convert_nosharpen.sh
ln -sf /usr/syno/bin/convert_nosharpen.sh /usr/syno/bin/convert


I hope it helps.

--edit: switched for a perl script that can handle filenames with spaces in them; also replaced -size by -sample which is much faster but lower quality.
benob
I'm New!
I'm New!
 
Posts: 2
Joined: Wed Jun 23, 2010 9:19 pm

Re: convert - thumbnail parameters

Postby lebeno » Wed Jun 30, 2010 10:54 pm

Tried your solution and it works perfectly! Thumbnail generation is much faster!
lebeno
I'm New!
I'm New!
 
Posts: 1
Joined: Wed Jun 30, 2010 10:49 pm

Re: convert - thumbnail parameters

Postby mdrl » Tue Jul 27, 2010 11:09 pm

benob wrote:On the DS110j, ..............


So, I suggest that the Synology guys put an option for slow/fast image indexing. In the mean time, on my DS110j, I wrote a wrapper script that removes the option:

Code: Select all
#!/usr/bin/perl -w
@new_args = ();
$old_arg = "";
for $arg(@ARGV) {
        if($arg eq "-size") { $arg = "-sample"; }
        if($arg ne "-unsharp") {
                if($old_arg ne "-unsharp") {
                        push @new_args, $arg;
                }
        }
        $old_arg = $arg;
}
exec "/lib/hddapp/usr/syno/bin/convert", @new_args;


put it in /usr/syno/bin/convert_nosharpen.sh
chmod and relink to use it (on my system, convert was a link to/lib/hddapp/usr/syno/bin/convert) :

Code: Select all
chmod +x /usr/syno/bin/convert_nosharpen.sh
ln -sf /usr/syno/bin/convert_nosharpen.sh /usr/syno/bin/convert


I hope it helps.

--edit: switched for a perl script that can handle filenames with spaces in them; also replaced -size by -sample which is much faster but lower quality.


Can we just copy and paste the both code on the terminal ?
Thanks
DS109 + WD 2to
mdrl
Trainee
Trainee
 
Posts: 14
Joined: Tue Jul 20, 2010 9:01 pm

Re: convert - thumbnail parameters

Postby tfa_dk » Sun Oct 31, 2010 6:05 pm

Now I also try this, because I have 25000+ photo and 100% cpu usage.
But why just setting -sample when convert takes -thumbnail? I don't understand all this options, maybe someone can pick the right ones. :?

Code: Select all
/lib/hddapp/usr/syno/bin/convert --help

Version: ImageMagick 6.3.9 09/21/10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC

Usage: convert [options ...] file [ [options ...] file ...] [options ...] file

Image Settings:
  -adjoin              join images into a single multi-image file
  -affine matrix       affine transform matrix
  -alpha option        activate, deactivate, reset, or set the alpha channel
  -antialias           remove pixel-aliasing
  -authenticate password
                       decipher image with this password
  -attenuate value     lessen (or intensify) when adding noise to an image
  -background color    background color
  -bias value          add bias when convolving an image
  -black-point-compensation
                       use black point compensation
  -blue-primary point  chromaticity blue primary point
  -bordercolor color   border color
  -caption string      assign a caption to an image
  -channel type        apply option to select image channels
  -colors value        preferred number of colors in the image
  -colorspace type     alternate image colorspace
  -comment string      annotate image with comment
  -compose operator    set image composite operator
  -compress type       type of pixel compression when writing the image
  -define format:option
                       define one or more image format options
  -delay value         display the next image after pausing
  -density geometry    horizontal and vertical density of the image
  -depth value         image depth
  -display server      get image or font from this X server
  -dispose method      layer disposal method
  -dither              apply Floyd/Steinberg error diffusion to image
  -encoding type       text encoding type
  -endian type         endianness (MSB or LSB) of the image
  -family name         render text with this font family
  -fill color          color to use when filling a graphic primitive
  -filter type         use this filter when resizing an image
  -font name           render text with this font
  -format "string"     output formatted image characteristics
  -fuzz distance       colors within this distance are considered equal
  -gravity type        horizontal and vertical text placement
  -green-primary point chromaticity green primary point
  -intent type         type of rendering intent when managing the image color
  -interlace type      type of image interlacing scheme
  -interpolate method  pixel color interpolation method
  -label string        assign a label to an image
  -limit type value    pixel cache resource limit
  -loop iterations     add Netscape loop extension to your GIF animation
  -mask filename       associate a mask with the image
  -mattecolor color    frame color
  -monitor             monitor progress
  -orient type         image orientation
  -page geometry       size and location of an image canvas (setting)
  -ping                efficiently determine image attributes
  -pointsize value     font point size
  -preview type        image preview type
  -quality value       JPEG/MIFF/PNG compression level
  -quiet               suppress all warning messages
  -red-primary point   chromaticity red primary point
  -regard-warnings     pay attention to warning messages
  -sampling-factor geometry
                       horizontal and vertical sampling factor
  -scene value         image scene number
  -seed value          seed a new sequence of pseudo-random numbers
  -size geometry       width and height of image
  -stretch type        render text with this font stretch
  -stroke color        graphic primitive stroke color
  -strokewidth value   graphic primitive stroke width
  -style type          render text with this font style
  -taint               image as ineligible for bi-modal delegate
  -texture filename    name of texture to tile onto the image background
  -tile-offset geometry
                       tile offset
  -treedepth value     color tree depth
  -transparent-color color
                       transparent color
  -undercolor color    annotation bounding box color
  -units type          the units of image resolution
  -verbose             print detailed information about the image
  -view                FlashPix viewing transforms
  -virtual-pixel method
                       virtual pixel access method
  -weight type         render text with this font weight
  -white-point point   chromaticity white point

Image Operators:
  -adaptive-blur geometry
                       adaptively blur pixels; decrease effect near edges
  -adaptive-resize geometry
                       adaptively resize image with data dependent triangulation
  -adaptive-sharpen geometry
                       adaptively sharpen pixels; increase effect near edges
  -alpha option        activate, deactivate, reset, or set the alpha channel
  -annotate geometry text
                       annotate the image with text
  -auto-orient         automatically orient image
  -bench iterations    measure performance
  -black-threshold value
                       force all pixels below the threshold into black
  -blur geometry       reduce image noise and reduce detail levels
  -border geometry     surround image with a border of color
  -bordercolor color   border color
  -charcoal radius     simulate a charcoal drawing
  -chop geometry       remove pixels from the image interior
  -clip                clip along the first path from the 8BIM profile
  -clip-mask filename  associate a clip mask with the image
  -clip-path id        clip along a named path from the 8BIM profile
  -colorize value      colorize the image with the fill color
  -contrast            enhance or reduce the image contrast
  -contrast-stretch geometry
                       improve contrast by `stretching' the intensity range
  -convolve coefficients
                       apply a convolution kernel to the image
  -cycle amount        cycle the image colormap
  -decipher filename   convert cipher pixels to plain pixels
  -despeckle           reduce the speckles within an image
  -distort type coefficients
                       distort the image
  -draw string         annotate the image with a graphic primitive
  -edge radius         apply a filter to detect edges in the image
  -encipher filename   convert plain pixels to cipher pixels
  -emboss radius       emboss an image
  -enhance             apply a digital filter to enhance a noisy image
  -equalize            perform histogram equalization to an image
  -evaluate operator value
                       evaluate an arithmetic, relational, or logical
                       expression
  -extent geometry     set the image size
  -extract geometry    extract area from image
  -flip                flip image vertically
  -floodfill geometry color
                       floodfill the image with color
  -flop                flop image horizontally
  -frame geometry      surround image with an ornamental border
  -gamma value         level of gamma correction
  -gaussian-blur geometry
                       reduce image noise and reduce detail levels
  -geometry geometry   perferred size or location of the image
  -identify            identify the format and characteristics of the image
  -implode amount      implode image pixels about the center
  -lat geometry        local adaptive thresholding
  -layers method       optimize, merge,  or compare image layers
  -level value         adjust the level of image contrast
  -linear-stretch geometry
                       improve contrast by `stretching with saturation'
  -liquid-rescale geometry
                       rescale image with seam-carving
  -median radius       apply a median filter to the image
  -modulate value      vary the brightness, saturation, and hue
  -monochrome          transform image to black and white
  -motion-blur geometry
                       simulate motion blur
  -negate              replace every pixel with its complementary color
  -noise radius        add or reduce noise in an image
  -normalize           transform image to span the full range of colors
  -opaque color        change this color to the fill color
  -ordered-dither NxN
                       add a noise pattern to the image with specific
                       amplitudes
  -paint radius        simulate an oil painting
  -polaroid angle      simulate a Polaroid picture
  -posterize levels    reduce the image to a limited number of color levels
  -print string        interpret string and print to console
  -profile filename    add, delete, or apply an image profile
  -quantize colorspace reduce colors in this colorspace
  -radial-blur angle   radial blur the image
  -raise value         lighten/darken image edges to create a 3-D effect
  -random-threshold low,high
                       random threshold the image
  -recolor matrix      translate, scale, shear, or rotate image colors
  -region geometry     apply options to a portion of the image
  -render              render vector graphics
  -repage geometry     size and location of an image canvas
  -resample geometry   change the resolution of an image
  -resize geometry     resize the image
  -roll geometry       roll an image vertically or horizontally
  -rotate degrees      apply Paeth rotation to the image
  -sample geometry     scale image with pixel sampling
  -scale geometry      scale the image
  -segment values      segment an image
  -sepia-tone threshold
                       simulate a sepia-toned photo
  -set property value  set an image property
  -shade degrees       shade the image using a distant light source
  -shadow geometry     simulate an image shadow
  -sharpen geometry    sharpen the image
  -shave geometry      shave pixels from the image edges
  -shear geometry      slide one edge of the image along the X or Y axis
  -sigmoidal-contrast geometry
                       lightness rescaling using sigmoidal contrast
                       enhancement
  -sketch geometry     simulate a pencil sketch
  -solarize threshold  negate all pixels above the threshold level
  -splice geometry     splice the background color into the image
  -spread radius       displace image pixels by a random amount
  -strip               strip image of all profiles and comments
  -swirl degrees       swirl image pixels about the center
  -threshold value     threshold the image
  -thumbnail geometry  create a thumbnail of the image
  -tile filename       tile image when filling a graphic primitive
  -tint value          tint the image with the fill color
  -transform           affine transform image
  -transparent color   make this color transparent within the image
  -transpose           flip image vertically and rotate 90 degrees
  -transverse          flop image horizontally and rotate 270 degrees
  -trim                trim image edges
  -type type           image type
  -unique-colors       discard all but one of any pixel color
  -unsharp geometry    sharpen the image
  -vignette geometry   soften the edges of the image in vignette style
  -wave geometry       alter an image along a sine wave
  -white-threshold value
                       force all pixels above the threshold into white

Image Sequence Operators:
  -append              append an image sequence
  -average             average an image sequence
  -clut                apply a color lookup table to the image
  -coalesce            merge a sequence of images
  -combine             combine a sequence of images
  -composite           composite image
  -crop geometry       cut out a rectangular region of the image
  -deconstruct         break down an image sequence into constituent parts
  -flatten             flatten a sequence of images
  -fx expression       apply mathematical expression to an image channel(s)
  -map filename        transform image colors to match this set of colors
  -morph value         morph an image sequence
  -mosaic              create a mosaic from an image sequence
  -process arguments   process the image with a custom image filter
  -reverse             reverse image sequence
  -separate            separate an image channel into a grayscale image
  -write filename      write images to this file

Image Stack Operators:
  -clone index         clone an image
  -delete index        delete the image from the image sequence
  -insert index        insert last image into the image sequence
  -swap indexes        swap two images in the image sequence

Miscellaneous Options:
  -debug events        display copious debugging information
  -help                print program options
  -list type           print a list of supported option arguments
  -log format          format of debugging information
  -version             print version information

By default, the image format of `file' is determined by its magic
number.  To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps).  Specify 'file' as
'-' for standard input or output.
tfa_dk
I'm New!
I'm New!
 
Posts: 8
Joined: Sun Oct 17, 2010 1:16 pm

Re: convert - thumbnail parameters

Postby tfa_dk » Tue Nov 02, 2010 1:27 am

You can count numbers of files with thumbs like this:

1) Start PuTTY on your PC and log in as root
2) Change to photo folder
Code: Select all
cd /
cd volume1
cd photo

3) find and count thumb files (This process a while)
Code: Select all
find . -name *:THUMB_M* | wc -l


Show how logn time the count take
Code: Select all
DS01> time find . -name *:THUMB_M* | wc -l
real    0m 47.16s
user    0m 1.31s
sys     0m 4.39s
8550


Show number of file processed by convert in 5 min
Code: Select all
DS01> find . -name *:THUMB_M* | wc -l; sleep 250; find . -name *:THUMB_M* | wc -l
8575
8580
tfa_dk
I'm New!
I'm New!
 
Posts: 8
Joined: Sun Oct 17, 2010 1:16 pm

Re: convert - thumbnail parameters

Postby canumaso » Fri Nov 12, 2010 1:47 am

New DS209 user here. After transfering files from my previous enclosure which had become too large to back up, I decided to start playing with some of the applications, begining with photo station 4. Since I had already loaded the files onto the synology I simply moved them over through file station. I moved more than 13gb worth of jpegs and avi files (mostly jpegs) at one time, and now its taking forever to index. Any more experienced users care to ventue a guess on how long this will take?
canumaso
Beginner
Beginner
 
Posts: 25
Joined: Sat Nov 06, 2010 4:07 pm

Re: convert - thumbnail parameters

Postby wayneljw » Wed Dec 08, 2010 7:12 am

Hi All,

I would like to know is there any way to modify the code so:
Whenever it generates the 800*800 thumbnail, it generates 1920*1920 instead.

Using the code by benob, it looks like we can do something from there.

Basically, what I need is:
In the photo station, there is only 2 options to set the default image width: 640, 800.
I don't use the photo station web browser very much, but I do use iPad or PS3 to browse my images.
When I set photo station to read the original-size images, it will take very long to load each image.
but the 800*800 images are too poor for displaying on iPad or PS3.

The question can be found here: viewtopic.php?f=17&t=28667

Note: I don't want to make this "convert" update all images to 1920*1920 (because ... at least it still needs to generate smaller thumbnails.)
I only want to make this program: whenever it is generating 800*800, it converts to 1920*1920 instead.
(question: should we say 800*800 or 800*600 in this case? Should we say 1920*1920 or 1920*1440 in this case?)

thank you very much.
wayneljw
Trainee
Trainee
 
Posts: 15
Joined: Sun Apr 11, 2010 4:08 pm

Re: convert - thumbnail parameters

Postby wayneljw » Thu Dec 09, 2010 6:07 pm

I found a solution:

Code: Select all
vi /usr/syno/bin/convert_1024.sh


Save this code as convert_1024.sh
Code: Select all
#!/usr/bin/perl -w
@new_args = ();
$old_arg = "";
for $arg(@ARGV) {
  if($arg eq "640x640") {
    if($old_arg eq "-size") {
      $arg = "1024x1024";
    }
    if($old_arg eq "-thumbnail") {
      $arg = "1024x1024";
    }
  }
  push @new_args, $arg;
  $old_arg = $arg;
}
exec "/lib/hddapp/usr/syno/bin/convert", @new_args;


Quit vi and RUN COMMAND
Code: Select all
chmod +x /usr/syno/bin/convert_1024.sh
ln -sf /usr/syno/bin/convert_1024.sh /usr/syno/bin/convert


However, I could not figure out how to ask the DS to re-create the thumbnails. Using the re-index function doesn't re-create the thumbnails.
So what I do is to delete all photos from the DS and then copy them into the photo folder again (so it triggers the thumbnail re-creating).
wayneljw
Trainee
Trainee
 
Posts: 15
Joined: Sun Apr 11, 2010 4:08 pm

Re: convert - thumbnail parameters

Postby 1991NSX » Fri Dec 24, 2010 6:53 am

Thanks to everyone for sharing script for making the thumbnail process faster. I've have my DS211j for 2 weeks now and have been waiting much of that time for it to complete converting. Sadly, it still doesn't look like it will be done any time soon.

The idea of changing the parameters to help speed up the process seems like a great idea but I'm not much of a techie and can't figure out where to cut and insert the scripts/code mentioned above. Would someone be so kind as to briefly list the steps so that I too can change the parameters?

I'd like to try benob's code for skipping the 'unsharp' option and biteaba's suggestion of reducing the size by 50% but just cant figure out how to insert code and how to access thumb.conf.

BTW. none of these options will actually alter the master files, correct? These are just thumbnails used for viewing and the original files are available for downloaded through photostation if so desired, correct?

Thanks in advance.
1991NSX
I'm New!
I'm New!
 
Posts: 1
Joined: Fri Dec 24, 2010 6:29 am

Re: convert - thumbnail parameters

Postby Scotia » Sat Jan 08, 2011 2:11 pm

Hello!

I am also very interested in having a solution for this...but i also dont know where i need to put these commands.

Can someone who has succeeded in doing so maybe write a how to tutorial?

I am using a mac if that makes a difference!

This is really something that Synology should do..I dont know if the other NAS systems are this slow, but as its our main usage i would consider changing!
Scotia
I'm New!
I'm New!
 
Posts: 6
Joined: Thu Jul 08, 2010 3:57 pm

Re: convert - thumbnail parameters

Postby crblev » Sat Jan 15, 2011 12:09 am

I tried this on my DS211J-- but it only thumbnailed a few items and then everything else came up as broken thumbnail images.
EDIT: But thanks for the tip though!

For the 'non technical' folks asking -- if you're not comfortable working in the linux terminal, I would avoid trying this.

Have to admit, the slowness of native thumnailing is surprising...
Anyone know how I can delete thumbnail caches and force a redraw of them w/o deleting and reuploading files? A previous post suggested makethumb, but that doesn't seem to exist in DSM 3.0

Cheers,
Chuck
crblev
I'm New!
I'm New!
 
Posts: 5
Joined: Sat Jan 15, 2011 12:01 am

Re: convert - thumbnail parameters

Postby BenH » Thu Mar 03, 2011 6:11 pm

Thanks for that suggestion, I tried it and it worked after a fashion. Before, it was taking around two minutes to generate the thumbnails for a single image, now it's going about twice as fast, about a minute per image. Not bad but not great unfortunately.

This whole thumbnail thing is crazy. I had a poke around in the directories, it actually creates 5 (!) thumbnails for each image, all of different sizes including large ones no matter that they are larger than the original image. So, for a single 1024 by 768 image that is around 200k it creates..

SYNOPHOTO:THUMB_XL.jpg (300k, 1280x960)
SYNOPHOTO:THUMB_L.jpg (157k, 800x600)
SYNOPHOTO:THUMB_B.jpg (71k, 640x480)
SYNOPHOTO:THUMB_M.jpg (30k, 320x240)
SYNOPHOTO:THUMB_S.jpg (6k, 120x90)

So, a 200k file now takes up 760k of storage! I tried the same with in image with a non-standard aspect ratio and that was respected, the thumbnails were correct but it seems mad to create 5 files for every one in the respect of both time and storage. I have around 6500 images currently taking up around 5 gig, when I copy them over it will then take up an additional 3.5 gig for the thumbnails plus it'll take 5 days to generate them all assuming it takes around 1 minute to generate 5 thumbnails from an original image of around 1700x1080.

Thats crazy.
BenH
I'm New!
I'm New!
 
Posts: 1
Joined: Thu Mar 03, 2011 5:10 pm

Re: convert - thumbnail parameters

Postby RobD » Mon Mar 07, 2011 11:14 am

I had all this sorted out by uploading my 40G of photos via the uploader and that took about a day to make the thumbs and convert videos. But....... the DSM 3.1 upgrade seems to have kicked off thumbnail creation again. This time it is regenerating all thumbnails again plus XL thumbs (SYNOPHOTO:THUMB_XL.jpg) that I didn't have before. If I upload via the photo uploader at DMS 3.1 I still don't get the XL thumbs.

So do I leave thumbnail creation to run for weeks (gaining the XL thumbs) or go through the upload procedure to pointlessly recreate the thumbs I already have. Sigh.
RobD
I'm New!
I'm New!
 
Posts: 5
Joined: Fri Feb 18, 2011 4:24 pm

Re: convert - thumbnail parameters

Postby krex » Thu Mar 10, 2011 10:24 pm

benob wrote:On the DS110j, indexing pictures takes days (if not weeks). I have found out that the -unsharp option to convert seems to be the culprit. For instance, on my NAS:
...
So, I suggest that the Synology guys put an option for slow/fast image indexing. In the mean time, on my DS110j, I wrote a wrapper script that removes the option:
...
put it in /usr/syno/bin/convert_nosharpen.sh
chmod and relink to use it (on my system, convert was a link to/lib/hddapp/usr/syno/bin/convert) :
....
I hope it helps.

--edit: switched for a perl script that can handle filenames with spaces in them; also replaced -size by -sample which is much faster but lower quality.



Sir, you've saved my life :-) well done, thank you!
krex
I'm New!
I'm New!
 
Posts: 4
Joined: Fri Apr 02, 2010 9:18 pm

Next

Return to Photo Station

Who is online

Users browsing this forum: No registered users and 2 guests