Page 1 of 1

More affine transform problems

Posted: 2009-02-25T07:47:54-07:00
by ivan.savu
Not sure if this one is related to this bug.. But when I apply scaling transformation to an image I get image thats a bit smaller then expected.. in example..

Code: Select all

	
	Image image("C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/Sunset.jpg");
	DrawableAffine affine(3.0,  1.0, 0, 0, 0.0, 0.0);
	image.affineTransform(affine);
	image.write("C:/test2.png");
The source image is 800x600, and expected result should be 2400x600 yet I get 2399x600. When using Image::resize everything works fine.

Re: More affine transform problems

Posted: 2009-02-25T16:47:35-07:00
by anthony
Yes I know of the bug and am working on it, when I can get time from my paying job.

NOTE: the scaled image size may be two pixels LARGER to include filter blurring aspects along the edges!!! So a 800 pixels scaled by 3 may produce a 2402 pixel image but with a -1 pixel negative offset!!!!

Distort is not a orthogonal resize but also includes filtering beyond the edges of image proper. Virtual Pixels are important!!!!

When fixed this part will be demonstrated properly by the IM example, where distort is used for orthogonal image resizing...
http://www.imagemagick.org/Usage/resize/#distort

At the moment that example is being clipped along the right and bottom edges making them appear 'sharp' when in reality they aren't.

Sorry for the delay...

Re: More affine transform problems

Posted: 2009-02-26T00:29:29-07:00
by ivan.savu
Thanks, didn't want to sound pushy there, take your time.

I still have few questions.. If I understand correctly, after being fixed, 800 pixels scaled by 3 will produce 2400 sharp pixels, and 1 blurry pixel on each edge ?

Re: More affine transform problems

Posted: 2009-02-26T20:20:02-07:00
by anthony
ivan.savu wrote:Thanks, didn't want to sound pushy there, take your time.

I still have few questions.. If I understand correctly, after being fixed, 800 pixels scaled by 3 will produce 2400 sharp pixels, and 1 blurry pixel on each edge ?

Yes. The only reason -resize does not do this is that it is limited to orthogonal rescaling, and onlu resamples using actal image pixels, ignoring any and all samples outside the original.

You will be able to achieve the same effect in affine (when fixed) by using a transparent virtual pixels, chopping of the extra edge pixel, though for exactness you should keep it on.

Note the image's virtual offset will preserve the images correct placement on the virtual canvas.

Re: More affine transform problems

Posted: 2009-03-09T21:10:41-07:00
by anthony
The over clipping of 'bestfit' +distort and thus -affine/-transform has now been committed. It will appear in the next release of IM v6.5.0-0

As mentioned images from affine are 'layer' images with an appropriate layers offset and typically an additional pixel added per side (totaling 2 pixels larger) than you may expect. You can either shave, crop, or layer the image appropriately.

Remember it is a layer image do it is aligned correctly on the virtual canvas as appropriate for the affine transform applied, so should be treated accordingly.

Re: More affine transform problems

Posted: 2009-03-10T02:58:40-07:00
by ivan.savu
Thanks for fixing it :D Is the release date for IM 6.5.0-0 Known ?

Re: More affine transform problems

Posted: 2009-03-10T15:55:45-07:00
by anthony
Regardless of what happens it should be within a week. Otherwise it is when a major bug gets fixed. It is up to Crisy (Magick) who still does most of the bug fixing.
It may be in the last point release, as the size problem was fixed early in my current rounds during which a 'point' release was made, but I can't guarantee it. check the ChangeLog file that in in the release to be certain.

You can of course download the SVN repository and build your own version or a package, and guarantee getting the very lastest changes. I do this anyway as part of my own updates and patching.

Re: More affine transform problems

Posted: 2009-03-10T16:46:45-07:00
by magick
ImageMagick 6.5.0-0 is available for download now.