Skip to content

Instantly share code, notes, and snippets.

@sorl sorl/synthumbs
Created Oct 5, 2012

Embed
What would you like to do?
Synology thumbnail generation
#include <iostream>
#include <string>
#include <libgen.h>
#include <Magick++.h>
using namespace std;
using namespace Magick;
string out( string fn, string sz ) {
return "@eaDir/" + fn + "/SYNOPHOTO:THUMB_" + sz + ".jpg";
}
int main( int, char **argv) {
InitializeMagick(*argv);
Image im;
string src = argv[1];
string fn = string( basename( strdup( src.c_str() ) ) );
struct th {
string geometry;
string size;
};
th sizes [4] = {
{ "800x800>", "L" },
{ "640x640>", "B" },
{ "320x320>", "M" },
{ "120x120>", "S" }
};
im.read( src );
im.scale("1280x1280>");
im.unsharpmask(0.5, 0.5, 1.25, 0.0);
im.write( out( fn, "XL" ) );
for ( int j=0; j<4; j++) {
im.scale( sizes[j].geometry );
//cout << out( fn, sizes[j].size ) << endl;
im.write( out( fn, sizes[j].size ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.