Man! Thank YOU for this nice samples.

Actually, I was trying this: 
http://www.imagemagick.org/Usage/advanced/#3d-logos

I used it because it allows me to control both Lighting images. And the 
default normalize is not right for me, because the resulting shades has 
extreme colors. That is, it is rendered too bright and too dard for both 
lighting.

You can try it yourself, and you'll notice the extreme white and black. 
If you can, please send the MagickWand codes for generating this.

Thanks,
Elie Zedeck.

PS: My timezone is GMT+3; currently midnight, but got to get this 
completed tonight.

Pete Whatever wrote:
> Which kind of functions do you need to use? I have written quite a few image 
> processing functions using MagickWand with Windows XP but I haven't used 
> Normalize or ContrastStretch. I'll add some of my functions to this email for 
> you. Each example is a function which can be "dropped" into your code to test 
> it and has an #ifdef/#endif around each one.
>
> If you have any more questions let me know. (my timezone is GMT-6)
> Best Wishes
> Pete
>
> #ifdef MASK
>
> // http://www.imagemagick.org/discourse-server/viewtopic.php?f=10&t=10993
> // Replicate this command line:
> // convert -size 640x480 xc:none -fill white -draw 'roundRectangle 15,15 
> 624,464 15,15' logo: -compose SrcIn -composite  result.png
> #include <windows.h>
> #include <wand/magick_wand.h>
>
> void test_wand(void)
> {
>       MagickWand *m_wand = NULL;
>       MagickWand *l_wand = NULL;
>       PixelWand *p_wand = NULL;
>       DrawingWand *d_wand = NULL;
>
>       MagickWandGenesis();
>
>       m_wand = NewMagickWand();
>       l_wand = NewMagickWand();
>       p_wand = NewPixelWand();
>       d_wand = NewDrawingWand();
>       PixelSetColor(p_wand,"none");
>       // Read the image
>       MagickNewImage(m_wand,640,480,p_wand);
>       PixelSetColor(p_wand,"white");
>       DrawSetFillColor(d_wand,p_wand);
>       DrawRoundRectangle( d_wand, 15,15, 624,464, 15,15 );
>       MagickDrawImage(m_wand, d_wand);
>
>       MagickReadImage(l_wand,"logo:");
>       // Note that MagickSetImageCompose is usually only used for the 
> MagickMontageImage function
>       // and isn't used or needed by MagickCompositeImage
>       MagickCompositeImage(m_wand,l_wand,SrcInCompositeOp,0,0);
>
>       /* Write the new image */
>       MagickWriteImage(m_wand,"mask_result.png");
>
>       /* Clean up */
>       if(m_wand)m_wand = DestroyMagickWand(m_wand);
>       if(l_wand)l_wand = DestroyMagickWand(l_wand);
>       if(d_wand)d_wand = DestroyDrawingWand(d_wand);
>       if(p_wand)p_wand = DestroyPixelWand(p_wand);
>       MagickWandTerminus();
> }
> #endif
>
> #ifdef RESIZE_QUALITY
> /*
>       Read an image, cut its dimension in half using a Lanczos filter,
>       set the image compression quality to 95 and then write the resulting 
> image
>
> */
> #include <windows.h>
> #include <wand/magick_wand.h>
>
> void test_wand(void)
> {
>       MagickWand *m_wand = NULL;
>
>       int width,height;
>
>       MagickWandGenesis();
>
> if(0){
>       // Optionally generate a MessageBox with the ImageMagick version
>       long l_version;
>       MessageBox(NULL,GetMagickVersion(&l_version),"",MB_OK);
> }
>
>
>       m_wand = NewMagickWand();
>       // Read the image
>       MagickReadImage(m_wand,"chsp.jpg");
>       // Get the image's width and height
>       width = MagickGetImageWidth(m_wand);
>       height = MagickGetImageHeight(m_wand);
>       // Cut them in half but make sure they don't underflow
>       if((width /= 2) < 1)width = 1;
>       if((height /= 2) < 1)height = 1;
>
>       // Resize the image
>       // The filter is one of:
>       //%    Bessel   Blackman   Box
>       //%    Catrom   Cubic      Gaussian
>       //%    Hanning  Hermite    Lanczos
>       //%    Mitchell Point      Quandratic
>       //%    Sinc     Triangle
>       // The blur factor is a "double", where > 1 is blurry, < 1 is sharp
>       MagickResizeImage(m_wand,width,height,LanczosFilter,0.5);
>
>       // Set the compression quality to 95 (high)
>       MagickSetImageCompressionQuality(m_wand,95);
>       /* Write the new image */
>       MagickWriteImage(m_wand,"chsp_rs.jpg");
>
>       /* Clean up */
>       if(m_wand)m_wand = DestroyMagickWand(m_wand);
>
>       MagickWandTerminus();
> }
> #endif
>
>
>
>
> #ifdef PAINTFLOODFILL
> // Replace the white area of logo: with transparent and don't forget
> // that for this the channel must be "rgba" and the image must be PNG
> // or other format which supports transparency
> // NOTE the difference of floodfill used here (it doesn't replace ALL
> // white pixels) and the function used in SET_TRANSPARENT
> #include <windows.h>
> #include <stdio.h>
> #include <string.h>
> #include <wand/magick_wand.h>
>
> void test_wand(LPTSTR lpCmdLine)
> {
>       MagickWand *m_wand = NULL;
>       PixelWand *fc_wand = NULL;
>       PixelWand *bc_wand = NULL;
>       ChannelType channel;
>
>
>       MagickWandGenesis();
>       m_wand = NewMagickWand();
>       fc_wand = NewPixelWand();
>       bc_wand = NewPixelWand();
>
>       MagickReadImage(m_wand,"logo:");
>
>
>       PixelSetColor(fc_wand,"none");
>       // AHA! Bordercolor must be none for generic colour replacement
>       PixelSetColor(bc_wand,"white");
>       channel = ParseChannelOption("rgba");
>
> // Don't need this even if (or because of?) rgba is specified
> //    MagickSetImageMatte(m_wand,MagickTrue);
>
> // MagickPaintFloodfillImage is DEPRECATED and is replaced by 
> MagickFloodfillPaintImage
> // MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,  
> //            const ChannelType                       channel,
> //            const PixelWand                         *fill,
> //            const double                            fuzz,
> //            const PixelWand                         *bordercolor,
> //                    const long x,const long y,
> //            const MagickBooleanType         invert);        // paint those 
> that DON'T match
>
> // MagickBooleanType MagickPaintFloodfillImage(MagickWand *wand,
> //  const ChannelType channel,const PixelWand *fill,const double fuzz,
> //  const PixelWand *bordercolor,const long x,const long y)
> // AHA!! The bordercolor (with fuzz applied) is replaced by the fill colour.
>
> // Use the newer function instead of the deprecated one
> // replace background with foreground
> if(0) MagickPaintFloodfillImage(m_wand,channel,fc_wand,73.0,bc_wand,400,400);
> else  
> MagickFloodfillPaintImage(m_wand,channel,fc_wand,3.0,bc_wand,0,0,MagickFalse);
>       MagickWriteImage(m_wand,"logo_paintflood.png");
>       /* and we're done so destroy the magick wand etc.*/
>       fc_wand = DestroyPixelWand(fc_wand);
>       bc_wand = DestroyPixelWand(bc_wand);
>       m_wand = DestroyMagickWand(m_wand);
>       MagickWandTerminus();
> }
> #endif
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to