{
return in;
}
try
{
Resample res = new Resample();
res.setFilter(Resample.FILTER_TYPE_LANCZOS3);
res.setInputImage(in);
float thumbRatio = 1.0f;
float imageRatio = (float)in.getWidth() / (float)in.getHeight();
int width = maxLength;
int height = maxLength;
if (thumbRatio < imageRatio)
{
height = (int)(maxLength / imageRatio);
}
else
{
width = (int)(maxLength * imageRatio);
}
//float x = (float)in.getWidth() / maxLength;
//float y = (float)in.getHeight() / maxLength;
res.setSize(width, height);
res.process();
return res.getOutputImage();
}
catch (OperationFailedException ofe)
{
return null;
}