Problem scaling images with application.createJPGImage

Hi all,

We are using the sintproScannerPlugin to scan images. Afterwards, a method scales the images to create images and thumbnails for web pages. Sometimes the thumbnail gets stretched. The form has two IMAGE_MEDIA fields, both with scrollbars set to none/none. One is size 190, 182 and the other one 110,99.

var scan = plugins.sintproScannerPlugin.Scan();
if(scan) {
	var jpg_image = application.createJPGImage(scan, 300, 300);
	cover = jpg_image;
	var thumb = application.createJPGImage(scan, 100, 100);
	thumbnail = thumb;
} else {
	thumbnail = null;
}

jpg_image is always fine, while thumb fails to scale correctly in 20% of the cases. Makes me think there may be a scaling bug in application.createJPGImage…

Anyone else had problems with this?

Hmmm… looks like a bug, my sintproScannerPlugin returns a BufferedImage object, application.createJPGImage should be able to resize it correctly.

Anyway try to create first the JPG image with the real size using:

var jpg_image = application.createJPGImage(scan,-1,-1)

and then try to scale jpg_image using application.createJPGImage again or using the new image plugin, I know it’s a waste of memory but try it as a workaround.
As soon as I find some spare time to finish my plugin you will be able to retrieve the image directly as a JPG image just by submitting the parameters for compression to the plugin.