Create several thumbnails from a single original image
Posted: 2011-12-18T18:26:36-07:00
I want to create thumbnails of different sizes from the same source image. I am able to create a single thumbnail with this code:
Now I want to create another thumbnail from test.jpg:
I could create another wand and call MagickReadImage again, but since this is for a busy internet server, there is probably a more efficient way of doing it, without reading the disk again. How can I keep "test.jpg" in memory while creating several thumbs?
Code: Select all
g_Magickwand = NewMagickWand();
MagickReadImage( g_Magickwand, "test.jpg" )
MagickResizeImage( g_Magickwand, "150", "100", LanczosFilter, 1.0 );
MagickWriteImage( g_Magickwand, "test_tn1.jpg" );
g_Magickwand = DestroyMagickWand( g_Magickwand );
Code: Select all
...
MagickResizeImage( some_wand, "300", "200", LanczosFilter, 1.0 );
MagickWriteImage( some_wand, "test_tn2.jpg" );
...