SuperSampling and AI

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
NitroPye

SuperSampling and AI

Post by NitroPye »

I'm having a slight issue going from the command line or PHP to the C MagickWand API. I cannot get super sampling to work. Its probably in part due to my lack of fully grasping the concepts.

From the command line this works:

Code: Select all

convert -density 244 -resize 25% input.ai output.png
What would the C MagickWand code be? Currently I'm doing something like this

Code: Select all

MagickSetResolution(_wand, 244, 244);
MagickReadImage(_wand, "ai:/path/to/input.ai");
MagickAdaptiveResizeImage(_wand, _size.width, _size.height); // I feel like this is where I'm doing things wrong
MagickWriteImage(_wand, "/path/to/output.png");
Thanks in advance.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: SuperSampling and AI

Post by el_supremo »

You don't explain what is going wrong but I'd suggest that you need code something like this:

Code: Select all

MagickAdaptiveResizeImage(_wand, MagickGetImageWidth(_wand)/4,MagickGetImageHeight(_wand)/4);
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
NitroPye

Re: SuperSampling and AI

Post by NitroPye »

Thanks el_supremo.

The code essentially does what I'm doing already. I should have pointed out that _size is a struct containing the images original size.

The problem I am having is that the resulting image at the size I want ends up all jagged where as running from the command line using convert I end up with a nice smooth supersampled image.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: SuperSampling and AI

Post by el_supremo »

The convert command doesn't use adaptive resize for the -resize option. It uses ResizeImage which you can access through MagickResizeImage.
Try this statement:

Code: Select all

MagickResizeImage(_wand, _size.width, _size.height,LanczosFilter,1.0);
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
NitroPye

Re: SuperSampling and AI

Post by NitroPye »

Thanks, that worked a charm. I guess I should read up on my image scaling algos.
Post Reply