Reduce time for zoom image without loosing image quality..

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sri123
Posts: 5
Joined: 2010-06-21T02:43:54-07:00
Authentication code: 8675308

Reduce time for zoom image without loosing image quality..

Post by sri123 »

Hello All,

I am using image magick 6.6.6 version for my VC++ application. In this application i am loading image (with 1920X1080 dimensions) and increasing image size with 25% zoom.
It takes 953 milli seconds per 25% zoom, 1500 milli seconds per 50% zoom and 2344 milli seconds per 75% zoom and increasing when size increases.

code for this is:

Code: Select all
Geometry tNailSize( szx, szy );
tNailSize.aspect(true);
m_Image.filterType(CatromFilter);
m_Image.zoom(tNailSize);

If i am using "scale" method to zoom the time reduces but after several zoomin and zoomouts the quality of image reduced.

Code: Select all
Geometry tNailSize( szx, szy );
tNailSize.aspect(true);
m_Image.scale(tNailSize);

I want to get the same performance of the zoom with the "Zoom" method.

How can i reduce the time taking for zoom in the first case?

Can any one help me to reduce time for zoom image without loosing image quality?

Thanking you advance..
sri123
Posts: 5
Joined: 2010-06-21T02:43:54-07:00
Authentication code: 8675308

Re: Reduce time for zoom image without loosing image quality

Post by sri123 »

Hello All,

I am loosing quality of image even if i use filters.

I used the "CatromFilter" to increase the size of the image as follows

Code: Select all

 Geometry	tNailSize(  szx, szy );
	tNailSize.aspect(aspect);
	m_Image.density("1550X1550");
	m_Image.filterType(CatromFilter);
	m_Image.zoom(tNailSize);
and to reduce size i am using ""LanczosFilter" filter as follows.

Code: Select all

  Geometry	tNailSize(  szx, szy );
	tNailSize.aspect(aspect);
	m_Image.density("1550X1550");
	m_Image.filterType(LanczosFilter);
	m_Image.zoom(tNailSize);
In these two caseses if do zoomin and zoomout several times (say >25) times i am getting distorted/blured image.

My application need to do more zoomin and zoomout operations.

Can you please help me what to do to get exact image?

Thanks in Advance.
User avatar
foxyshadis
Posts: 15
Joined: 2010-04-29T19:29:46-07:00
Authentication code: 8675308
Location: Fresno, California

Re: Reduce time for zoom image without loosing image quality

Post by foxyshadis »

Many zooms in and out will always give you distortion. That's just how it works. Why on earth would you expect it to look good when you throw away 50-90% of the information and then try to regenerate it with an algorithm, 25 times in a row? That's unrealistic.

If you can perform any kind of windowing or cropping prior to the resize, do so. Working with gigantic images is slow, so remove as many pixels as possible to cut down on processing times; you could even try bilinear resize. If multithreading isn't working, try segmenting the image and processing in parallel at a higher level. Also, using lanczos to downscale will probably result in less-pleasing images, because it tends to alias more the smaller you go.
sri123
Posts: 5
Joined: 2010-06-21T02:43:54-07:00
Authentication code: 8675308

Re: Reduce time for zoom image without loosing image quality

Post by sri123 »

Thanks for the help,

I solved my problem in another way. Zoomin the original image with out altering.

Regards
Sri
Post Reply