[Kde-imaging] [Bug 129902] New: HTML gallery : resize pictures in constant area instead of size max (see patch)

Frédéric COIFFIER frederic.coiffier at free.fr
Tue Jun 27 14:14:07 CEST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=129902         
           Summary: HTML gallery : resize pictures in constant area instead
                    of size max (see patch)
           Product: kipiplugins
           Version: unspecified
          Platform: Gentoo Packages
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: general
        AssignedTo: kde-imaging kde org
        ReportedBy: frederic.coiffier free fr


Version:           0.1.0 (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages
Compiler:          gcc (GCC) 4.1.1 (Gentoo 4.1.1) 
OS:                Linux

Currently, a size is given and each pictures are resized to have its max edge length = size.
But, if the picture is a panorama (where width is very bigger than height), the scaling gives a very small picture.

In fact, the better way could be to have a constant area (for example, resized width * resized height = size^2). So all pictures have the same number of pixels.
In the case of 4/3 photos, it changes nothing but panoramas are correctly resized.

In kipi-plugins/htmlexport/generator.cpp, I use the following code :

#include <math.h>

...

				// Process full image
				{
					if (mInfo->fullResize()) {
						double size=(double)mInfo->fullSize();
						int newwidth = (int)sqrt((size*size*(double)image.width())/(double)image.height());
						int newheight = (int)(size*size/(double)newwidth);
						image=image.smoothScale(newwidth, newheight, QImage::ScaleFree);
					}


More information about the Kde-imaging mailing list