More affine transform problems

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
ivan.savu

More affine transform problems

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: More affine transform problems

Post 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...
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ivan.savu

Re: More affine transform problems

Post 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 ?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: More affine transform problems

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: More affine transform problems

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ivan.savu

Re: More affine transform problems

Post by ivan.savu »

Thanks for fixing it :D Is the release date for IM 6.5.0-0 Known ?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: More affine transform problems

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: More affine transform problems

Post by magick »

ImageMagick 6.5.0-0 is available for download now.
Post Reply